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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create PDF by Chrome headless #13

Open
cognitom opened this issue Jun 7, 2017 · 1 comment
Open

How to create PDF by Chrome headless #13

cognitom opened this issue Jun 7, 2017 · 1 comment

Comments

@cognitom
Copy link
Owner

cognitom commented Jun 7, 2017

Chrome 59 has supported a new headless mode! 馃帀

To try it, add a line below to your .bash_profile:

alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"

Then, reload .bash_profile:

$ source ~/.bash_profile

and, run Chrome in headless mode:

$ chrome --headless --disable-gpu --virtual-time-budget=1000 --print-to-pdf=github.pdf https://github.com/
  • --disable-gpu: this is needed to avoid error
  • --print-to-pdf: set file to output
  • --virtual-time-budget: set time to wait after document ready (for SPA)

See more details here:

Good luck!

@petrovic-ivan
Copy link

How to delay pdf print if window load event is fired but page is not rendered yet?

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

2 participants