You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found this repo after reading this thread - the commenter is right - it's a lifesaver, so thank you so much!
I have a question though - I'm trying to make a page that can be viewed as a webpage, but can also have a PDF generated from it - with a header and footer applied (mostly for page numbering).
For the body content I'm using some print CSS (via the @media print {} CSS query) to make a few style changes between the PDF version and the web version which is working well, but if I apply something like:
to the CSS, the header/footer aren't rendered at all on the PDF.
I'm not quite sure why that is... I'm sort of assuming the header and footer templates get kind of pre-rendered and inserted to the PDF, so maybe aren't evaluated as being print media? I had a look at the code but can't really work it out.
Do you think it might be an easy fix? Other than this it's working beautifully for me!
The text was updated successfully, but these errors were encountered:
It looks like that worked, although I had to use await page.emulateMediaType("print");. Looks like emulateMedia was deprecated - puppeteer/puppeteer#6084
I'm happy just keeping that in my PDF script if you don't want to force it in this library.
Hi!
I found this repo after reading this thread - the commenter is right - it's a lifesaver, so thank you so much!
I have a question though - I'm trying to make a page that can be viewed as a webpage, but can also have a PDF generated from it - with a header and footer applied (mostly for page numbering).
For the body content I'm using some print CSS (via the
@media print {}
CSS query) to make a few style changes between the PDF version and the web version which is working well, but if I apply something like:to the CSS, the header/footer aren't rendered at all on the PDF.
I'm not quite sure why that is... I'm sort of assuming the header and footer templates get kind of pre-rendered and inserted to the PDF, so maybe aren't evaluated as being print media? I had a look at the code but can't really work it out.
Do you think it might be an easy fix? Other than this it's working beautifully for me!
The text was updated successfully, but these errors were encountered: