page.pdf First page not complete when too big and second page not print at all
See original GitHub issueSteps to reproduce
- Puppeteer version: 1.11.0
- Platform / OS version: Windows 10, same on https://try-puppeteer.appspot.com/
- Node.js version: 10.9.0
What steps will reproduce the problem?
Here is the code that uses page.pdf()
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://certificate-demo.bcdiploma.com/dev/index.html#/pdf/0CE409BCD5360E6BD2DDD1DBA0AF9D0E6B40658F8745870007EF027114F41BF0qEFaPHixFa8RTaL9zI4weB6%252F5aEK2RAOGgeo81ZJ3REeAOXR');
await page.waitFor(() => document.querySelector('.certificat-face--front'), {timeout:10000}) ;
await page.evaluate(() => {
var buttons = document.getElementsByClassName('certificat-sticky-buttons');
for (var i = 0; i < buttons.length; i++) { buttons[i].style.display = "none"; }
buttons = document.getElementsByClassName('certificat-button-wrapper');
for (var i = 0; i < buttons.length; i++) { buttons[i].style.display = "none"; }
buttons = document.getElementsByClassName('ignorePDF');
for (var i = 0; i < buttons.length; i++) { buttons[i].style.display = "none"; }
buttons = document.getElementsByClassName('click');
for (var i = 0; i < buttons.length; i++) { buttons[i].style.display = "none"; }
buttons = document.getElementsByTagName('button');
for (var i = 0; i < buttons.length; i++) { buttons[i].style.display = "none"; }
});
await page.addStyleTag( {'content': '@page {size: auto}'} );
await page.emulateMedia('screen');
await page.pdf({path: 'screenshot.pdf',format: 'A4', landscape: true, printBackground: true, scale: 0.7});
await browser.close();
What is the expected result?
In the target url, I have two divs with the 'page-break-after: always;'
style, which are supposed to be displayed on each pages.
I expect to get a PDF file with two pages, one for each div section.
What happens instead?
I only got one page, the second one is not print at all, although it is displayed correctly in chromium.
When the first div is too big, it is truncated in the pdf file. This is normal when the option format: 'A4'
is set, but it is happening even when it it not.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:6
Top Results From Across the Web
page.pdf First page not complete when too big and second ...
I only got one page, the second one is not print at all, although it is displayed correctly in chromium. When the first...
Read more >Troubleshoot PDF printing in Acrobat and Reader
Try printing this troubleshooting page. If you can't, follow these steps to check your connection to the printer:.
Read more >PDF displays correctly in Adobe Reader, but doesn't print ...
Answer: If the PDF displays correctly but prints on a paper printer incorrectly, it's most often a issue with Adobe Reader or the...
Read more >Word does not Print page range, only full document 2021
This issue occurs if the page number does not match the number of pages for custom printing. It is recommended to generate consecutive...
Read more >Choose a paper size for your printed document on Mac
In apps such as Pages or Microsoft Word, you can also specify a page size for a document as you're working on it....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same
We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!