Browser crashes when trying to print a very large page (or save to pdf) - affects puppeteers pdf functionality
Reported by
ch...@gurutechnologies.net,
Nov 1
|
|||||||
Issue description
Chrome Version : 70.0.3538.77
URLs (if applicable) : N/A
Other browsers tested:
Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
Safari: N/A
Firefox: N/A
Edge: N/A
What steps will reproduce the problem?
(1) Have HMTL page that is quite large (mine was 5.4mb, and renders to over 1k pages in pdf form)
(2) Hit CTRL+P
(3) Wait for browser to crash (takes a long time)
Other browsers don't have a print preview - and this is mainly for the purpose of saving to PDF from print dialog or using Puppeteer to generate pdfs. We have an option for users to generate a PDF of their cities entire legal code (users work for cities, and our software manages their cities code) and we've decided puppeteer is awesome because it supports any web features chrome supports - however we had to resort to a hack in which we generate several (usually about 10-20) pdfs individually and combine them by splitting their code by "title". To have accurate page numbers after generating each segment PDF we see it's page count and add that to the total. Then for the next PDF we include the total number of pages thus far worth of divs that say "page-break-after: always", and give puppeteer a page range to save so we don't get that many blank pages.
What is the expected result?
Browser doesn't crash.
What happens instead?
Browser crashes.
What solutions would I like to see?
Obviously if the browser could merely "work" when generating giant pdfs, that would be great. But I understand that having such a giant dom tree and generating a pdf can be difficult - and it's easier for us to "split" the task into smaller trees that do fit in memory more easily.
That being said, this would be much easier if much like the configurations available to puppeteer for displaying headers and footers, providing them templates, and defining page sizes for pdfs, if you could provide a "page number offset". This would also make various other tasks much easier. If this is the solution you choose to implement, you may want to warn users their page is too large for printing and saving to pdf when they hit ctrl+p rather than just loading for 15 minutes and then crashing.
,
Nov 2
Puppeteer invokes Chromium is headless mode, which does not use Print Preview. Normal users print with Ctrl + P, and that does bring up Print Preview. This is 2 different actions that take 2 different code paths. Which one is crashing for you? Both? Do you have crash report ID(s)? https://www.chromium.org/for-testers/bug-reporting-guidelines/reporting-crash-bug I tried print previewing the attached document. It took a very very very long time, but the action succeeded without crashing.
,
Dec 3
No feedback was received in the last 30 days from the reporter, so archiving this issue. Please re-open or file a new bug if necessary. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Dec 3
Both crash. If it's not crashing for you it's likely linked to ram or something. Crashes for me both ways. Of course puppeteer uses chromium in headless mode - the reason I'm under the impression they share some code is because they behave very similarly. Both can create PDF's and have similar flags. In print preview you can toggle headers and footers on an off and they appear exactly the same as the headers in pdf gen of puppeteer with the same toggle. Regardless both crash for me (eventually).
,
Dec 8
So can you get a crash report id? https://www.chromium.org/for-testers/bug-reporting-guidelines/reporting-crash-bug
,
Dec 8
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Dec 8
,
Dec 18
Sorry - I've been busy at work and haven't had a spare sec to come back to this. As mentioned in OP we came up with a work-around for our purposes. For some reason this time around I was able to get a print preview for massivedoc.html. I roughly doubled it's size and tried again. One other thing I noticed is that if you don't wait for the page to load fully before hitting ctrl+p it will generate a print preview of a portion of the page successfully. That may be why it was working for me with the smaller doc, but I'll load the doubled doc just in case. So updated steps: Open the .html Wait for loading to complete Hit CTRL+P Wait until browser crashes
,
Dec 18
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by krajshree@chromium.org
, Nov 2