dliw/fpCEF3

Add print handler implementation to LCLCefClient

Opened this issue · 7 comments

dliw commented

Follow-up of issue #39.

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

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 commented

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

dliw commented

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.

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 commented

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.

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 commented

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 😄