Skip to content

[Bug]: Page.pdf: PDF generation is only supported for Headless Chromium #2909

Closed
@reuvenstr

Description

@reuvenstr

Version

1.53.0

Steps to reproduce

Install everything

pip install playwright
playwright install webkit
playwright install-deps webkit 

run code

import asyncio
from playwright.async_api import async_playwright, Browser, Page

async def create_pdf():
    playwright = await async_playwright().start()
    browser = await playwright.webkit.launch(headless=True)
    context = await browser.new_context(ignore_https_errors=True)
    page = await context.new_page()
    await page.set_viewport_size({"width": 1366, "height": 768})
    await page.goto("https://google.com")
    await page.pdf(path="/tmp/test.pdf", format="A4", print_background=True)

loop = asyncio.new_event_loop()
loop.run_until_complete(create_pdf())

Get error
Error: Page.pdf: PDF generation is only supported for Headless Chromium

Expected behavior

creates pdf

Actual behavior

undocummented error

Additional context

Is there any alternative? Should documentation have been updated about such restrictions?

Environment

- Operating System: [Ubuntu 22.04]
- CPU: [amd64]
- Browser: [WebKit]
- Python Version: [3.10]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions