puppeteer: Print to PDF call not working as expected in example?
In the example:
await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle'});
await page.pdf({path: 'hn.pdf', format: 'A4'});
This output is generated (for me at least)
But below is what I get if I manually print from a Chrome browser on the same page.
Some other sites work as expected, maybe an issue with HN?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (7 by maintainers)
Commits related to this issue
- Teach page.pdf to respect printBackground argument References #301 — committed to puppeteer/puppeteer by aslushnikov 7 years ago
- Teach page.pdf to respect printBackground argument (#307) References #301 — committed to puppeteer/puppeteer by aslushnikov 7 years ago
@campbecf: there are different defaults. Puppeteer defaults
printBackground
tofalse
, whereas chrome has it set totrue
by default.There are also other defaults, like margins, which you can tweak to achieve the same results.
@campbecf how does your PDF has 2 pages split according to the content . Sorry for asking it in here . Can you please help me here. I am successfully able to PDF a long pages of content but in a single page . I wanted to split it like your example pdf according to content.