Page.pdf - Colors rendering
See original GitHub issueWhen I run my page in headless mode every colors is rendered right. But when I get the pdf with page.pdf() with no options some colors (a few in fact) are wrong - too bright or too dark - Is there any reason for this?
update: I solved this with this css (not sure why it wasn’t working without it)
html {
-webkit-print-color-adjust: exact;
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:146
- Comments:18 (5 by maintainers)
Top Results From Across the Web
Color conversion and ink management (Acrobat Pro)
Convert document colors · In the Convert Colors dialog box, select a conversion command. · Specify the conversion profile. · Select the rendering...
Read more >Render-as PDF: Where'd the colors go? - Salesforce Developers
The background colors render fine in HTML but are absent in PDF. ... WITHOUT the page attribute 'render-as="pdf",' the colors render as I'd ......
Read more >Puppeteer not rendering color, background color when I try to ...
js and HTML template code which creates a PDF from an HTML template. It's not putting in the colors. const puppeteer = require('puppeteer');...
Read more >Acrobat Pro does not render PDF colors correctly on screen
Acrobat Pro (tried 8 and 7) does not render colors correctly on screen ... 2004 and Pages 3.0.2. but e.g. FreeHand MX PDFs...
Read more >PDF color rendered incorrectly - Google Chrome Community
Hi Guys, I found an issue when I open a PDF via Chrome browser, the color or the first page rendered incorrectly.
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
This worked for me,
-webkit-filter
item is requiredThanks for sharing your solution–that wasn’t a fun problem to debug.
The color changes appear to be part of the browser’s strategy for reducing print cost and achieving more accurate colors on paper. It’s part of the browser’s printing functionality, which is why the colors only change when using
page.pdf()
as opposed to opening the page in a browser. This isn’t really a problem with Puppeteer but really should be somewhere in its documentation.You can read more about this here: https://drafts.csswg.org/css-color-4/#color-adjust