Reputation: 73
The images - 2 - and some styles - 1 - doesn't load when I use puppeteer page.pdf.
Even if I set page.waitForNavigation
.
If I use the same code with page.screenshot
instead of page.pdf
it works!
Code:
const puppeteer = require( 'puppeteer' );
const link = 'https://chrome.google.com/webstore/category/extensions?hl=pt-BR';
( async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto(link);
await page.waitForNavigation({timeout: 120000, waitUntil: 'networkidle', networkIdleTimeout: 3000});
await page.pdf({path: 'page.pdf'});
// if I remove page.pdf and change to the line below it works!
//await page.screenshot({fullPage: true, path: 'page.png'});
browser.close();
})()
Upvotes: 0
Views: 1986
Reputation: 73
Set printBackground param to true
await page.pdf( { path: 'test.pdf', printBackground: true } )
Upvotes: 2