docs(api.md): add note on page.pdf() color rendering behavior (#2821)
Adds guidance for producing accurate colors in PDF output. page.pdf() can produce unexpected document colors unless forced to render exact colors. Fixes #2685
This commit is contained in:
parent
871b204fd1
commit
acb89dddba
@ -1250,6 +1250,8 @@ Page is guaranteed to have a main frame which persists during navigations.
|
|||||||
|
|
||||||
`page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call [page.emulateMedia('screen')](#pageemulatemediamediatype) before calling `page.pdf()`:
|
`page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call [page.emulateMedia('screen')](#pageemulatemediamediatype) before calling `page.pdf()`:
|
||||||
|
|
||||||
|
> **NOTE** By default, `page.pdf()` generates a pdf with modified colors for printing. Use the [`-webkit-print-color-adjust`](https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust) property to force rendering of exact colors.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Generates a PDF with 'screen' media type.
|
// Generates a PDF with 'screen' media type.
|
||||||
await page.emulateMedia('screen');
|
await page.emulateMedia('screen');
|
||||||
|
Loading…
Reference in New Issue
Block a user