diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md index f65a904932..f44bd18696 100644 --- a/docs/src/api/class-page.md +++ b/docs/src/api/class-page.md @@ -2762,10 +2762,6 @@ This method requires Playwright to be started in a headed mode, with a falsy [`o Returns the PDF buffer. -:::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 [`method: Page.emulateMedia`] before calling `page.pdf()`: diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index 7086d87f2e..34b83cfc52 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -3609,8 +3609,6 @@ export interface Page { /** * Returns the PDF buffer. * - * **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([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) before calling * `page.pdf()`: diff --git a/tests/library/pdf.spec.ts b/tests/library/pdf.spec.ts index 3ef002e25c..38e8c7b5be 100644 --- a/tests/library/pdf.spec.ts +++ b/tests/library/pdf.spec.ts @@ -17,9 +17,8 @@ import { browserTest as it, expect } from '../config/browserTest'; import fs from 'fs'; -it('should be able to save file', async ({ contextFactory, headless, browserName }, testInfo) => { - it.skip(!headless || browserName !== 'chromium', 'Printing to pdf is currently only supported in headless chromium.'); - +it('should be able to save file', async ({ contextFactory, browserName }, testInfo) => { + it.skip(browserName !== 'chromium', 'Printing to pdf is currently only supported in chromium.'); const context = await contextFactory(); const page = await context.newPage(); const outputFile = testInfo.outputPath('output.pdf'); @@ -27,9 +26,8 @@ it('should be able to save file', async ({ contextFactory, headless, browserName expect(fs.readFileSync(outputFile).byteLength).toBeGreaterThan(0); }); -it('should be able to generate outline', async ({ contextFactory, server, headless, browserName }, testInfo) => { - it.skip(!headless || browserName !== 'chromium', 'Printing to pdf is currently only supported in headless chromium.'); - // const context = await contextFactory(); +it('should be able to generate outline', async ({ contextFactory, server, browserName }, testInfo) => { + it.skip(browserName !== 'chromium', 'Printing to pdf is currently only supported in chromium.'); const context = await contextFactory({ baseURL: server.PREFIX, });