Adding Print Options to Cef3

Issue #1283 new
Former user created an issue

Original issue 1283 created by biskark on 2014-05-12T18:11:08.000Z:

Now that printing has been added to Cef3, is there any work being done to adding the ability to modify the PrintSettings programatically? This feature was exposed in Cef1 and is something my team would like to keep as we move to Cef3. This was previously exposed in the CefPrintHandler class which no longer exists.

Comments (20)

  1. Marshall Greenblatt

    Comment 1. originally posted by magreenblatt on 2014-05-12T18:33:35.000Z:

    No work currently in-progress. Patches welcome.

  2. Former user Account Deleted

    Comment 3. originally posted by biskark on 2014-05-12T19:01:15.000Z:

    Good to know, I will look into a patch.

  3. Former user Account Deleted

    Comment 4. originally posted by biskark on 2014-06-05T18:29:33.000Z:

    So these are my initial changes to get this working. This will likely only work for Windows builds, and both patches must be used for this to work. I had to make changes to both Cef and Chromium. The CefClient has an example of how these can be used. For those interested in this feature, let me know what you think.

  4. Marshall Greenblatt

    Comment 5. originally posted by magreenblatt on 2014-06-12T20:34:00.000Z:

    Thanks for the patches. Printing on Windows is currently broken after the most recent Chromium update (see issue comment 13.13). That will need to be resolved before moving forward with these changes.

  5. Former user Account Deleted

    Comment 6. originally posted by randa.jakub on 2014-07-16T08:26:37.000Z:

    Any news about integrating this into CEF3? Would be really helpful for us.

  6. Former user Account Deleted

    Comment 7. originally posted by cameron.howey on 2014-08-30T01:59:58.000Z:

    Windows printing seems to work fine now, is this feature now on the agenda?

  7. Former user Account Deleted

    Comment 8. originally posted by olda.esner on 2014-09-26T08:45:54.000Z:

    We try to bind CefPrintHandler in CefBrowserProcessHandler class but we can't catch print event (Windows 7, fork of Xillium project with CEF 3.2062.1835).

    If you click on window.print function you'll get only print dialog without any event inside .NET code.

    Have you tried to test this function also on Windows OS?

  8. Marshall Greenblatt

    Comment 9. originally posted by magreenblatt on 2014-09-26T15:37:57.000Z:

    @ comment 8.: As stated in the comments the CefPrintHandler class is only used on Linux.

  9. Former user Account Deleted

    Comment 10. originally posted by olda.esner on 2014-09-26T15:52:29.000Z:

    @ comment 9.: Is there any chance to use CefPrintHandler also on Windows? What should we (or someone else) do to enable this function on Windows OS?

    We need to suppress print dialog in order to print silently.

  10. Marshall Greenblatt

    Comment 11. originally posted by magreenblatt on 2014-09-26T15:56:25.000Z:

    @ comment 10.: I would like to eventually expose CefPrintHandler on other platforms but at this time it would require substantial changes to Chromium.

  11. Former user Account Deleted

    Comment 12. originally posted by olda.esner on 2014-09-26T15:59:35.000Z:

    @ comment 10.: Is there any ticket that is going to solve this substantial changes or any future plan to implement print on Windows?

  12. Johann Scheiterbauer

    The linked Issue changed to Fixed. How is the status? Will printing be better supported in Windows OS in future?

  13. Marshall Greenblatt

    Chrome's print extension shows some options like "fit in page" that don't appear on the standard OS print dialog. It would therefore be necessary for the client to implement a custom print dialog and feed the settings back into CEF. We have a similar implementation on Linux with CefPrintHandler and CefPrintSettings, but that implementation is platform-specific and does not address non-standard options like "fit in page".

  14. Johann Scheiterbauer

    As mentioned above, we would need that mechanism for the WinOS too. Is there anything planned in near future?

  15. Dmitry

    I have implemented silent print in branch 2171 and it works fine for WinOS. This mechanism is asynchronious and has two handlers - OnPrintingFinished and OnPrintingFailed. I attached patch for branch 2526, it also works fine for Windows but can't be applied because 2526 building is not yet supported. For newer branches i don't now how to modify chromium. Everything works for cef, but chromium part has two bugs: 1. Silent printing fails during printing (FrameHostMsg_RenderProcessGone message received). 2. Handlers are never called. Maybe i'll solve this problems in future, but now i haven't enough time to work with it.

  16. Philipp Kirchner

    @magreenblatt Is there anyway to tell CEF to use the CEFPrintHandler - Codepath instead of the Platform Dialogues as it does for linux?

  17. Log in to comment