CEF PDF Printing on Mac broken

Issue #2453 duplicate
Philipp Kirchner created an issue

it seems that printToPDF is broken at least on Mac.

MacOS 10.13.5, CEf 3.3396.1775

  • No honoring of print stylesheet
  • not working pagesize attributes (seems to be always A3, no matter what I use for size...)
  • pdf is always 1 page, regardless of size of content.

Is there any pointer where to look at? I would be happy to help fixing this...

Can reproduce this with CEFClient as well (Tests->PrintToPDF)

I'm using these CefPdfPrintSettings:

CefPdfPrintSettings pdfSettings;
pdfSettings.backgrounds_enabled = 0;
pdfSettings.header_footer_enabled = 0;
pdfSettings.margin_bottom = 0;
pdfSettings.margin_top = 0;
pdfSettings.margin_left = 0;
pdfSettings.margin_right = 0;
pdfSettings.margin_type = PDF_PRINT_MARGIN_NONE;
pdfSettings.landscape = 0;
pdfSettings.selection_only = 0;
pdfSettings.scale_factor = 100;
pdfSettings.page_height = 0; //297*1000; //Default A4
pdfSettings.page_width = 0; //210*1000; //Default A4

Comments (4)

  1. Marshall Greenblatt

    @kirchnerp Do print stylesheet and pagesize attributes work correctly in older CEF versions?

  2. Philipp Kirchner reporter

    It seems to work fine in most cases. When printing from an iFrame, the BrowserHost gets the PrintToPDF Message and prints the whole browser.

    in contrast to that, when using just window.print() only the iFrame is printed.

    @magreenblatt: I'm currently lost when the PrintNow() message gets forwarded to the RenderFrameHost to figure out why this works. Can you give me pointers where to look at? My goal is silent printing.... (Exchanging the Mac PlatformDialog with CEFPrintHandler would be the ultimate goal...)

  3. Log in to comment