PDF generation bug in latest releases

This issue has been tracked since 2022-12-09.

Describe the bug
The latest versions of the docker images are causing PDFs to be incorrectly generated. Contents of the PDF would shrink to around 2/3rds of the page.

To Reproduce
Steps to reproduce the behavior:

  1. Use the latest browserless/chrome:latest or /chrome:1-puppeteer-13.1.3 or /chrome:1-puppeteer-19.2.2
  2. Render a document as usual
  3. Document would be incorrectly generated, see screenshots below.

Expected behavior

Rendered PDF content shrinks, expected not to.

Screenshots
Difference between docker image versions

/chrome:1-puppeteer-10.4.0 or /chrome:1-puppeteer-14.4.1 /chrome:latest or /chrome:1-puppeteer-13.1.3 or /chrome:1-puppeteer-19.2.2
image image

As you can see the latter screenshot content has shrunken and the second page's content disappeared.

Desktop (please complete the following information):
Irrelevant

Smartphone (please complete the following information):
Irrelevant

Additional context

Our code has not changed and we have been using /chrome:latest for several years but the latest releases starting from Dec 2, 2022 caused this bug.

andyMrtnzP wrote this answer on 2022-12-17

What's the URL of the example screenshot?

devalberg wrote this answer on 2022-12-23

Unfortunately I do not have a link for this. The PDF is temporarily generated internally then later saved, but we've set a fixed version of the docker image which we know works and it "solves" the problem and therefore don't have a URL for now :/

andyMrtnzP wrote this answer on 2023-01-20

Sorry for the delay on this. We checked this further, and it looks like from Chromium revision r1056772, the PDF renderer util renders all content slightly shrunk. The last revision compatible with puppeteer that doesn't shrink the contents i r1045629.

Unfortunately, this is a Chromium limitation. Although slightly increasing the PDF scale (to 1.043 in our tests) seems to help.

More Details About Repo
Owner Name browserless
Repo Name chrome
Full Name browserless/chrome
Language TypeScript
Created Date 2017-11-17
Updated Date 2023-03-22
Star Count 5309
Watcher Count 47
Fork Count 516
Issue Count 29

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date