Closed holytrousers closed 2 years ago
We don't specify a timeout when we call Page.pdf()
.
More than 30 seconds to generate a PDF seems a bit excessive but as you've mentioned maybe Chrome takes a bit of time when the document contains a lot of images.
Anyway, we should declare a new environment variable to configure this timeout: PUPPETEER_PRINT_TIMEOUT
.
The "default" timeout only applies to navigation (Page.goto
and Page.reload
) and rendering (Page.waitForFunction
).
We don't specify a timeout when we call
Page.pdf()
Indeed, the problem was with the misleading 'TIP'.
More than 30 seconds to generate a PDF seems a bit excessive but as you've mentioned maybe Chrome takes a bit of time when the document contains a lot of images.
Actually, the timeout happens when the document exceeds a dozen of pictures ( JPEG files around ~ 3MB size ) These pictures however are inserted in the page layout as running elements positioned inside the margins of the page, which might explain the excessive time. With the --preview option however, chromium renders the page in a couple of seconds.
Anyway, we should declare a new environment variable to configure this timeout:
PUPPETEER_PRINT_TIMEOUT
.
And a different message for this specific timeout.
The "default" timeout only applies to navigation (
Page.goto
andPage.reload
) and rendering (Page.waitForFunction
).
It might be even better to create a separate 'TIP' for each timeout since it actually isolates the problem. Thank you for your help !
Fixed in 643d5548bc9953e592957ccc356162b8523ab672
Hello first of all, i would like to express my gratitude for everybody's work on this project.
This error happens when a certain number of images is inserted into the document. Setting the appropriate environment variables doesn't help. Looks like the 30s value is hardcoded in this declaration
in
node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js
hope it helps others with fixing the problem Cheers !