Skip to content
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

PagedJS - Chrome Headless - Partial Rendering Problem #183

Open
canerozdemircgi opened this issue Feb 19, 2024 · 5 comments
Open

PagedJS - Chrome Headless - Partial Rendering Problem #183

canerozdemircgi opened this issue Feb 19, 2024 · 5 comments

Comments

@canerozdemircgi
Copy link

When using paged.js with google chrome headless in order to print pdf, it goes to the stage of printing as pdf before paged.js has able to finish its work.
Any way to overcome this ?

@julientaq
Copy link
Collaborator

julientaq commented Feb 19, 2024

hi there.

you can check how it’s done on pagedjs-cli repo (or simply it :D)

https://gitlab.coko.foundation/pagedjs/pagedjs-cli/

tell us if that helps.

@canerozdemircgi
Copy link
Author

canerozdemircgi commented Feb 19, 2024 via email

@julientaq
Copy link
Collaborator

julientaq commented Feb 19, 2024

i’m curious how do you use chrome headless? without pupeteer?

in any case, do you have the right content when you’re not headless?

do you have some code for us to try?

@canerozdemircgi
Copy link
Author

canerozdemircgi commented Feb 21, 2024

i’m curious how do you use chrome headless? without pupeteer?

in any case, do you have the right content when you’re not headless?

do you have some code for us to try?

example.zip
Attached an example html

Running this command
chrome --headless --disable-gpu --run-all-compositor-stages-before-draw --virtual-time-budget=5000 --print-to-pdf-no-header --no-pdf-header-footer --print-to-pdf=example.pdf example.html

It works if I set virtual-time-budget like 2147483647 (which is literally the max value it can take, it also works close values like 1000000000), but that is a quite bad solution and still doesn't guarantee. I presume the underlying reason is async functions of paged.js

@NigelCunningham
Copy link
Contributor

Take a look at the Drupal module printable, which I also maintain. I've got a file named waitFor.js (from memory) in there, that provides different ways of waiting for pagedJS to do its work. It might be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants