Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add print handler implementation to LCLCefClient #40

Open
2 of 3 tasks
dliw opened this issue Dec 21, 2016 · 7 comments
Open
2 of 3 tasks

Add print handler implementation to LCLCefClient #40

dliw opened this issue Dec 21, 2016 · 7 comments
Assignees

Comments

@dliw
Copy link
Owner

dliw commented Dec 21, 2016

Follow-up of issue #39.

  • TCefPrintHandlerOwn
  • implement printing to PDF for Linux in LCLCefClient
  • add general Linux printing support in LCLCefClient (very low priority)
@lucianomartini
Copy link

lucianomartini commented Dec 22, 2016

PDF function not working too. The pdf printing function runs without any error by following this code: http://wiki.freepascal.org/fpCEF3#Creating_a_pdf , but does not generate the pdf. I think is the same case!

@dliw
Copy link
Owner Author

dliw commented Dec 23, 2016

Yes indeed. One needs to implement the print handler in any case.

@dliw
Copy link
Owner Author

dliw commented Jan 3, 2017

The implementation of the print handler should be rather similar to the dialog handler. I don't know, when I will find time to complete this.

@lucianomartini
Copy link

Don't worry. First thank you for the download implementation, i think this will save my life. I am very happy with the fact that you will implement this two in your project examples!

@dliw
Copy link
Owner Author

dliw commented Jan 4, 2017

The latest fpCEF version now has a minimal print handler implementation, so that printing to PDF files is now supported.

Complete printing support on Linux is much more complicated unfortunately. There is a reference implementation of the print handler in CEF, but it is limited to GTK.

There is platform independent printing support in Lazarus through the Printer4Lazarus package, but it does not support printing PDF files, which is needed for the print handler.
The solution probably is to use CUPS directly. However, Printer4Lazarus does not really expose the CUPS interface and I did not find any other package ready to be used.

Maybe I'll try to complete the implementation sometime, but for now this is just too much out of the scope of fpCEF.

@lucianomartini
Copy link

lucianomartini commented Jan 4, 2017

This helped a lot (pdf printing can be use to run the command lp and send the pdf to the real printer). About the reference i will read it and try to implement. I am just a Linux administrator but i am trying to learn something if you discover this first than me please share.

And thank you about all this, how can i contribute with the project more?

@dliw
Copy link
Owner Author

dliw commented Jan 4, 2017

About the reference i will read it and try to implement.

If you want to use gtk, then you could indeed try.
But I think it is easier to use CUPS (API doc) directly - basically calling cupsPrintFile in TCustomPrintHandler.OnPrintJob. A header translation for CUPS can be found in cupsdyn.pp and there is a TCUPSPrinter class. However, both cannot be used directly - this may be worth a bug report in the Free Pascal bugtracker.
For the print settings TPrintDialog could be used.

I am just a Linux administrator but i am trying to learn something

Well, you started with a really challenging task ...

if you discover this first than me please share

Of course I will.

how can i contribute with the project more

Report bugs and ask questions (as long as the answers are not too obvious). Implementing the printing support, I found typing errors.
More (or extended) examples are very welcome, too. But in the end most of the "work" for fpCEF is working on issues, bugreports and questions 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants