Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Playwright adds margin to generated PDFs when specifying @page #34423

Closed
Jwiggiff opened this issue Jan 15, 2025 · 1 comment
Closed

Comments

@Jwiggiff
Copy link

Version

1.49.1

Steps to reproduce

A simple python program to reproduce the issue:
https://gist.github.com/Jwiggiff/b451f65fc6910c29ff50ffd3f118f2b4

Expected behavior

I expect no margin to be added to the printed PDF. i.e. the crop marks should be at the edge of the page, and it should be a one page PDF.

Actual behavior

It seems playwright adds a margin to the PDF.

Additional context

This specifically happens when the HTML contains a CSS @page rule, but the page.pdf call has prefer_css_page_size=False.

I've also tried adding margin: 0 in the @page rule as well as setting all margins to 0 in the page.pdf call.

Environment

- Operating System: [Ubuntu 22.04, MacOS 15.1.1]
- CPU: [Apple M2 Pro]
- Browser: [Chromium]
- Python Version: [3.12]
- Other info:
@Jwiggiff Jwiggiff changed the title [Bug]: [Bug]: Playwright adds margin to generated PDFs when specifying @page Jan 15, 2025
@mxschmitt mxschmitt transferred this issue from microsoft/playwright-python Jan 22, 2025
@pavelfeldman
Copy link
Member

For PDF, it is what it is, we just return what browser generates, it is not standardized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants