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

[question] How to convert a website that requires javascript to continue rendering? #193

Closed
StringKe opened this issue Apr 27, 2020 · 7 comments · Fixed by #319
Closed
Labels
enhancement New feature or request

Comments

@StringKe
Copy link

How to convert a website that requires javascript to continue rendering?

For example, a website written in Vue, some websites need to wait for the page to render specific content due to the use of the framework, otherwise thedom structure is empty

@StringKe
Copy link
Author

Wait time is not an optimal choice, can you listen to the javascript method such as console.log to output specific content while generating PDF

@gulien gulien added the enhancement New feature or request label Apr 27, 2020
@peterzhang41
Copy link

hi @gulien,

wkhtmltopdf, another famous PDFconversion tool, solved this by providing an optional parameter called
--window-status, which will wait until window.status is equal to a string before rendering a page.
https://wkhtmltopdf.org/usage/wkhtmltopdf.txt

Maybe we can have something similar to this, like --form waitJsRenderStatus='DONE' ?

There is a discussion in CDP that creates an eval injection to detect the js render status, which I believe it still requires to add a 17ms delay (60 frames fresh rate) behind the wait function for the web engine actually paint the changes.
mafredri/cdp#116

Have you been already working on this?
if not, I am keen to provide PR for this if you like the idea

@gulien
Copy link
Collaborator

gulien commented May 15, 2020

Hey @peterzhang41!

wkhtmltopdf, another famous PDFconversion tool, solved this by providing an optional parameter called
--window-status, which will wait until window.status is equal to a string before rendering a page.
https://wkhtmltopdf.org/usage/wkhtmltopdf.txt

I was not aware of the --window-status option in wkhtmltopdf, good catch! It would make a lot of sense for Gotenberg to have a similar option 👍

Have you been already working on this?
if not, I am keen to provide PR for this if you like the idea

Yes please! 😄Feel free to provide a PR, I'll gladly review it.

@peterzhang41
Copy link

peterzhang41 commented Jun 24, 2020

Hi gulien,

https://github.com/peterzhang41/gotenberg

Sorry for the delay. The PR is almost there. Unfortunately, I don't have time to finish the doc and unit-tests. Could you pick it up and finished it? My company are all-in-aws at this moment. I have to work on a lambda puppeteer solution for my project.

Cheers

@gulien gulien added this to the 7.0.0 milestone Jun 24, 2020
@gulien
Copy link
Collaborator

gulien commented Jun 24, 2020

@peterzhang41 thanks for your work.

I plan to rewrite most of the code for the version 7.0.0 of Gotenberg, I'll take a look at what you did on your fork 👍
Maybe I'll ask you to do a quick PR so that you'll be considered as a contributor 😄

@StringKe
Copy link
Author

StringKe commented Jul 2, 2020

@gulien 7.0 When will it be released?

@gulien
Copy link
Collaborator

gulien commented Jul 6, 2020

Early fall, but it could be sooner.

@gulien gulien mentioned this issue Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants