mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
Update api.md (#1773)
This commit is contained in:
parent
cd5a48ffcb
commit
bb0b6cd90a
@ -1368,13 +1368,13 @@ Page is guaranteed to have a main frame which persists during navigations.
|
||||
|
||||
> **NOTE** Generating a pdf is currently only supported in Chromium headless.
|
||||
|
||||
`page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call [page.emulateMedia({ type: 'screen' })](#pageemulatemediaoptions) 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({ media: 'screen' })](#pageemulatemediaoptions) 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
|
||||
// Generates a PDF with 'screen' media type.
|
||||
await page.emulateMedia({type: 'screen'});
|
||||
await page.emulateMedia({media: 'screen'});
|
||||
await page.pdf({path: 'page.pdf'});
|
||||
```
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user