alvarcarto / url-to-pdf-api

Web page PDF/PNG rendering done right. Self-hosted service for rendering receipts, invoices, or any content.
MIT License
7.01k stars 774 forks source link

can i use the css style 'print' to set the page pdf style #44

Closed lihaonanGY closed 6 years ago

lihaonanGY commented 6 years ago

I want the content to appear on a separate page, not with other content

pheisiph commented 6 years ago

you will need to pass emulateScreenMedia: false as a parameter to the request, to force chrome to parse print related CSS. With that chrome will afaik apply both @media print { ... } and @page { ... }.

You can then control what content goes on which page using the page-break-XXX rules.

pavle-lekic-htec commented 5 years ago

I tried that and it doesn't seem to work, or I'm not doing something right. I created a big table, and set page-break-after: always; rule to every 10th <tr> tag, hoping that it will break the page after it, but that doesn't happen. Am I doing something wrong?