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

Honoring the @page CSS media query #672

Open
timint opened this issue Dec 15, 2024 · 3 comments
Open

Honoring the @page CSS media query #672

timint opened this issue Dec 15, 2024 · 3 comments

Comments

@timint
Copy link

timint commented Dec 15, 2024

Hi, I couldn't get this framework to honor the @page CSS media query for printable media properties.

This concerns margin, size and zoom.

Migrating from both been using CLI commands and Puppeteer I was expecting this to be the default behavior even with the PHP library when ommitting a value for options: margins, or page width/height.

Use case example:

<style>
@media print {
  @page {
    margin: 0;
    zoom: 100%;
    padding: 0;
  }

  @page A4 {
    size: A4 portrait;
  }
  @page A4R {
    size: A4 landscape;
  }
  @page A5 {
    size: A5 portrait;
  }
  @page A5R {
    size: A5 landscape;
  }
}
</style>

<article style="page: A4">
  ...Page 1...
</article>

<article style="page: A4R">
  ...Page 2...
</article>

<article style="page: A5">
  ...Page 3...
</article>
@enricodias
Copy link
Member

How are you trying to inject those css properties, exactly?

@timint
Copy link
Author

timint commented Dec 17, 2024

They are on the page I'm loading. Like any webpage. Either inline style="", on page using <style>, or <link rel="stylesheet">.

@timint
Copy link
Author

timint commented Dec 17, 2024

Added a use case example here printable.zip:
https://file.io/Q9wo9D7DrMpP

Screenshot:
Screenshot

Printed:
printed.pdf

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

No branches or pull requests

2 participants