Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

CEF 85: PrintToPdf no longer works for PDF files

Post Reply
wolf
Posts: 20
Joined: Thu Jan 31, 2019 6:36 pm

CEF 85: PrintToPdf no longer works for PDF files

Post by wolf »

When I load a PDF file, I could use PrintToPdf to save this PDF file to a folder. This worked fine until CEF 84, but no longer works in CEF 85. The saved PDF files no longer have the correct content.

Is this no longer possible in Chromium 85? Or do I just miss a flag or parameter to get this working again?

Tested with CEF 85.3.10
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: CEF 85: PrintToPdf no longer works for PDF files

Post by salvadordf »

Apparently you're being affcted by this CEF issue :
https://bitbucket.org/chromiumembedded/ ... site-which

Try using the DevTools methods as the last comment says :
https://chromedevtools.github.io/devtoo ... printToPDF

The DOMVisitor and other demos have code examples about using similar DevTools methods. For example, this procedure executes the DOM.setAttributeValue method :
https://github.com/salvadordf/CEF4Delph ... r.pas#L913
https://chromedevtools.github.io/devtoo ... ibuteValue
wolf
Posts: 20
Joined: Thu Jan 31, 2019 6:36 pm

Re: CEF 85: PrintToPdf no longer works for PDF files

Post by wolf »

Apparently you're being affcted by this CEF issue :
https://bitbucket.org/chromiumembedded/ ... site-which
Hmm, I don't think that I'm affected by this CEF issue.

Please try to load http://www.orimi.com/pdf-test.pdf in BriskBard 2.1, then call "Print to PDF". The generated PDF will not show the content.

Then try it again in BriskBard 2.0 and it should work correctly.

This started with CEF85, previous versions were OK.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: CEF 85: PrintToPdf no longer works for PDF files

Post by salvadordf »

I tested this with the official CEF sample application and it also generates an empty PDF.

I'll add an issue in the CEF project. Meanwhile, keep using CEF 84 if you need that feature.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: CEF 85: PrintToPdf no longer works for PDF files

Post by salvadordf »

I added my findings to that CEF issue because the previous cefclient version (84) showed a print dialog when you tried to use the printtopdf function but now it creates an empty document. It seems to be the same issue but not completely fixed.
https://bitbucket.org/chromiumembedded/ ... site-which

If the CEF project maintainer thinks that it's a different issue he will ask me to create a new CEF issue at bitbucket.
marcoscdoni
Posts: 25
Joined: Thu Sep 21, 2017 4:33 pm

Re: CEF 85: PrintToPdf no longer works for PDF files

Post by marcoscdoni »

Hello, this problem still persists, correct?

I'm testing version 85 and the PDF appears blank, but if I click on the pdf the file is printed with the content correctly.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: CEF 85: PrintToPdf no longer works for PDF files

Post by salvadordf »

I'm afraid that the issue is not fixed in CEF 86. :oops:

The workaround works and you can print the PDF contents if you click on the document before printing.
Post Reply