puppeteer margins:none equivalence of chrome print
See original GitHub issueEven when i set margins 0 all. I am keep getting default margins my
@page{ margin: 0 !important; padding: 0 !important; }
i was searching long time for this and did found nothing that would help.
^1.9.0 puppeteer ubuntu 18.04 10.15.1 node
this.browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
const page = await this.browser.newPage();
// @ts-ignore
await page._emulationManager._client.send('Emulation.setDefaultBackgroundColorOverride', {
color: {
r: 0,
g: 0,
b: 0,
a: 0
}
});
await page.goto(
'https://google.com',
{
waitUntil: 'networkidle0'
}
);
await page.pdf({
path: '/home/pdf.pdf',
printBackground: true,
displayHeaderFooter: true,
format: 'A4',
preferCSSPageSize: true,
headerTemplate: '<span></span>',
footerTemplate: '<span></span>',
margin: {
left: '0',
right: '0',
top: '0',
bottom: '0'
};
});```
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Puppeteer ignores some CSS rules to print PDF when I used ...
I find the puppeteer always ignore some CSS rules which is in @media print. Here is my env: Puppeteer version: 1.11. Platform /...
Read more >Advanced Options - Headless Chrome - Api2Pdf
Attribute Type Description
landscape Boolean Paper orientation. Defaults to false.
displayHeaderFooter Boolean Display header and footer. Defaults to false.
printBackground Boolean Print background graphics. Defaults to...
Read more >Puppeteer generate PDF from HTML - Pocket Admin
This function generates a pdf document from html markup. Generating a pdf is currently only supported in Chrome headless! Generation pdf; Save ...
Read more >puppeteer page break pdf - I VIAGGI DI REMO
Download Puppeteer Tutorial (PDF Version) Previous Page Print Page Next Page ... It can also be configured to use full (non-headless) Chrome or...
Read more >page-break-after - CSS: Cascading Style Sheets | MDN
It's the page placed on the left side of the spine of the book or the back side of the page in duplex...
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
use
For me, this css did the trick: