Saving Webpages as PDF While Preserving Formatting
I have a number of webpages that I would like to archive as a PDF with the website formatting preserved. The normal process of saving to PDF via printing creates a file that I find unacceptable. I haven't had any luck finding a solution to this, although using Puppeteer would seem to be an option.
Does anyone have a suggestion on saving webpages as PDFs that display just like the webpage did in the browser?
👤 Someone Accepted Answer ✓
I don’t know how to do it reliably, but one thing that you want to do is to remove any or @media styles from the page (whether imported, inline, browser default, in your local overrides, etc).
After that, be prepared for the page size to make the page look different from the screen version. That difference can be striking.
👤 throwaway889900
Have you tried (in Firefox) screenshotting the entire page? If you don't need text to be selectable or anything then dumping that into a PDF might work. Otherwise you can use SingleFile to download the page and then convert that HTML to PDF using some other tool.