-
Notifications
You must be signed in to change notification settings - Fork 472
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
Print Preview still does not load for some websites #3768
Comments
The issue is still reproducible with the latest build and it affects websites printing. Do you have any idea how to fix this or is it possible to add a switch to re-enable the old alloy runtime and style to work as it did before 125, at least until the issue is properly fixed in a future version? |
I tried to debug this in a third party application and a difference I could notice between the cases when it works and it not works is that after the browser is stopped while waiting for printing to PDF to finish the following error is thrown: [0818/120745.703:ERROR:print_util.cc(40)] PrintToPDF failed with error: Printing failed The output path is set in code and it actually the same code works for other websites. I don't know why that path is not getting to printing process. |
What should be done to fix this issue? Could you please help? I don't understand how the output path can get empty in printer process. I tried both with sandbox and no-sandbox, debug and release builds. It is not a Chromium issue and only someone with a deep understanding of CEF code and advanced debugging skills could find the root cause of this and provide a fix. I could not find any switch recently added in Chromium which might change the behavior. |
Unfortunately this regresion seems to persist in the latest 129 release. It could be reproduced with the web pages from report and with many other websites I have tried. Off-screen printing to PDF, which should be an important feature from project description, cannot be reliably used after you made the alloy related changes. Do you have any plan to investigate and fix this in 129 or a in a future release of the project? |
Could you please clarify if windowless rendering will be further supported in CEF? Currently the PrintToPDF() calls hangs with many websites as soon as the windowless rendering is enabled. |
@magreenblatt Do you know what the status of this issue is? I assume it is an actual defect and not something that is unsupported. Similar to the initial report, tinkering with 128 and --use-alloy-style, I can print simple sites like google but on large/complex sites PrintToPdf hangs. Not sure it helps at all but if you navigate away from the site being printed, the
|
This issues is still reproducible in the latest build. Almost two months passed since the initial report. |
The same issue occurs when using the 'Page.printToPDF' method from DevTools protocol. The method closure callback is never invoked. If the windowsless rendering is disabled, the callback is invoked. |
I had this issue on linux with PrintToPDF not completing for some sites (specially the ones with google ads). The work around I found is described here: |
That definitely seems to be the issue. I added some logs on the IsReadyToComposite and if that returns false, the print "hangs". Now to decide what to do with this information. |
edgardogho's work around definitely improves the situation (thanks for that) but there are still issues. It seems to consistently create the PDF. The PDF is usually wrong, missing images and such. The completion callback also doesn't always get called. In the case of the print preview, it shows an error saying the preview failed. |
Yes, I can also confirm the workaround allows the print to PDF to finish even if with missing elements. Thanks @edgardogho for this. It is not clear yet why it works (without any change) when the windowsless rendering is disabled. It seems that Alloy style still plays a role in this issue and it needs further investigation for a complete fix. |
@jasminjasmin2 can you test if this issue is resolved in M130 (beta)? This comment suggests that it might be. |
Unfortunately it still reproduces in 130.3 both with cefclient print preview and with my windowless print to PDF application. The workaround suggested by @edgardogho allows printing to finish both in the case of this report and of the new #3798 report, but the frame content is missing. |
@magreenblatt Marshall, could you please take a look into this? There was a good progress here to workaround this issue and to isolate the it, but we simply could not figure out the root cause. What would you suggest to try further to debug this? |
What do you mean by this? What specific problems are you referring to? Is that with or without the changes to print_compositor_impl.cc mentioned above? Are you able to reproduce the problem in cefclient? If so, with what command-line flags?
Do you mean support Chrome style with windowless rendering? Maybe, see issue #3263. |
I was referring to the case of a third-party application that uses the PrintToPDF() function to create PDFs offscreen, without the changes to print_compositor_impl.cc. Those changes would indeed allow printing to PDF to finish, but with missing content. If windowless rendering is enabled in such an application by setting the flag windowless_rendering_enabled = true, then the printing hangs, and the OnPdfPrintFinished() callback is never called when I print https://www.corriere.it/ or other HTML pages with sandboxed iframes. If windowless printing is disabled by simply setting windowless_rendering_enabled = false, the PDF is created, but a browser window is displayed on the screen while printing, which is not the intended behavior. A similar issue is reproducible in cefclient, launched with the command:
If you load the https://www.corriere.it/ web page and try to print it, Print Preview will hang. This was the initial bug report, which is still reproducible with the latest builds of CEF.
Yes, is this a long-term plan, or could it be implemented in the near future? |
Just to clarify, this happens on a lot of other sites as well. I have been able to reliably reproduce the issue on tmz.com and digg.com. Many other sites exhibit the issue to some degree. I've seen it with yahoo.com, aol.com, cnn.com and some amazon.com product pages. This was with the --use-alloy-style in the cefclient and doing a print to pdf. |
Long-term possibility, not currently planned. |
Yes, the off-screen printing to PDF has been nearly unusable for the past few months in the latest versions of CEF. I thought it was a key feature of the project, but unfortunately it doesn't seem to be a priority for the project maintainers at this moment and the future of it is uncertain. |
Thanks everyone for your feedback on this issue. The related area of code (printing OOPIFs) is complicated, as shown in the design diagram. The proposed workaround indicates that something in this system is not working as expected (e.g. OOPIFs are never signaled as ready). Unfortunately I don't personally have time to dive into this currently. You (anyone) are welcome to take some time to properly understand and debug the Chromium code in this area. Given that Chrome style behavior appears to be working, comparing the execution paths for Chrome and Alloy style browsers in CEF side-by-side might provide the vital clue. |
@magreenblatt I've identified the root issue that is causing this problem with printing. AlloyBrowserHostImpl needs to implement PrintCrossProcessSubframe or something to that effect. Basic overview: |
@mbragg12 Good find. It looks like the related Chromium commit is https://crrev.com/5bb6597491. Can you try copy/pasting the Browser::PrintCrossProcessSubframe implementation to a new |
I duped the code from
|
Print preview does not work in cefclient 127 and the ''Loading preview.." message never disappears when trying to print https://www.corriere.it/ website but it works for other websites.
Programmatically, in custom windowsless applications calling the PrintToPDF() function, the OnPdfPrintFinished() callback is never called and the printer process never finishes.
To Reproduce
Steps to reproduce the behavior:
Versions (please complete the following information):
Additional context
In the case of some other websites, like www.gsp.ro, when trying to print to pdf in custom windows-less applications, setting the browser window rectangle to a quite large height, like 25,000 pixels, also makes the printer process to hang. Not sure if the issues are related. Setting a large browser window for such websites is necessary if the resources loading is triggered only for elements inside the viewport.
The issue does not reproduce with Chrome 127.0.6533.99
The text was updated successfully, but these errors were encountered: