cannot add background color to Header/Footer
See original GitHub issueI’m trying to customize the header and footer. But I cannot add the background color to the footer. And footer size is not the same.
This is what I’m trying to do.
page.pdf({ path: 'test.pdf', format: 'a4', landscape: '!data.isPortrait', footerTemplate: '<div class="footer" style="height:75px;position: absolute;background- color:red;top:auto;left:0px;right:0px;bottom:0px;">\ </div>', displayHeaderFooter: true, margin: { top: "75px", bottom: "75px" } });
- Puppeteer version:1.1.0
- Platform / OS version:ubuntu 16.04
- URLs (if applicable):
- Node.js version:8.9 What is the expected result? Footer background color should be in red color. What happens instead? Footer background color is not changed.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
cannot add background color to Header/Footer in pdf
To add background-color to header/footer or to the page in Puppeteer, we need to add an additional css property, -webkit-print-color-adjust: ...
Read more >Header & Footer Color change - Microsoft Community
I have a Header & footer that has a deep blue background & white text & after i click out of it the...
Read more >Changing the color of the header / footer background
Hi, I've forgotten how to change the color of the header / footer background. Some templates have the header and footer color set...
Read more >How do you change the header/footer colour on a single page?
I have CSS on the page to use a different logo in the header for just that page, but I can't get the...
Read more >Topic: Getting same header, footer and background color as ...
Hi there. I tried searching a bit, but I can't seem to find a decent tutorial on how to use the WordPress header,...
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 Free
Top 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
I found the solution. To add background-color to header/footer or to the entire page in Puppeteer, we need to add an additional css property,
-webkit-print-color-adjust: exact.
Now it works fine.For people who find this from Google, you can also add
printBackground: true
https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions