Every browser has a built-in "Print to PDF" option, and it's the first thing most people try when they need to save a webpage, invoice, or report as a PDF. It's also the reason so many of those PDFs come out with a chopped-off sidebar, a header repeating on every page, or a table that splits awkwardly across a page break. Print to PDF was built for printing a page, not for producing a clean document — the two goals overlap less than you'd think.
Here's how to actually get a webpage, HTML file, or raw HTML code into a proper PDF, and why a dedicated converter avoids the layout problems browser printing causes.
Why Browser "Print to PDF" Breaks Layouts
A browser's print function reuses your print stylesheet (or your regular one, if you don't have a dedicated @media print rule) and forces it into fixed page dimensions. That causes three predictable failures:
- Fixed and sticky elements duplicate. A nav bar or footer set to
position: fixeddoesn't understand "pages" — it can repeat on every single page of the output, or get cut mid-element. - Backgrounds and colors vanish. Most browsers strip background colors and images by default when printing, unless the page explicitly forces
print-color-adjust: exact— which most sites don't. - Content splits mid-element. A table row, an image, or a card can get sliced exactly at the page boundary, with no control over where the break happens.
None of this means the browser's print engine is broken — it's doing exactly what print stylesheets were designed for. It just means "save this page as a document" and "print this page" are different problems wearing the same UI.
Converting a Webpage URL to PDF
- Open HTML to PDF.
- Paste in the URL of the page you want to save.
- Convert — the tool renders the live page and outputs a PDF of exactly what's there.
- Download.
This is the fastest way to archive a webpage, save a receipt or confirmation page before it disappears, or turn a published article into a shareable document — without a screenshot stitching multiple images together.
Converting HTML Code or a File to PDF
If you're generating documents programmatically — invoices, reports, certificates, order confirmations — you're usually working from an HTML template rather than a live URL:
- Open HTML to PDF.
- Paste your raw HTML (or upload an
.htmlfile). - Convert to PDF and download.
This is the workflow behind most "download invoice as PDF" buttons on business software: the invoice is built as an HTML template with real data filled in, then converted to PDF at the moment the user requests it, rather than maintaining a separate PDF-generation library.
Designing HTML That Converts Cleanly
A few habits make the output dramatically more reliable than "write normal HTML and hope":
- Avoid
position: fixedandposition: stickyin content meant for PDF — use normal document flow instead. Fixed positioning is a browser-viewport concept that doesn't map cleanly to a paginated document. - Set explicit page-break rules with CSS (
page-break-inside: avoidon tables, cards, or images you don't want split) rather than letting the converter guess where a page should end. - Use relative units carefully.
vhandvware tied to viewport size, which doesn't exist the same way on a fixed PDF page — preferpx,pt,in, or%for anything that needs to render consistently. - Inline critical CSS or make sure stylesheets are fully accessible — a converter fetching your HTML can't apply a stylesheet it can't reach (blocked by auth, a relative path that doesn't resolve, etc.).
When to Use HTML-to-PDF vs. a Document Converter
| Starting point | Best tool |
|---|---|
| Already-written Word document | Word to PDF |
| Live webpage or HTML template | HTML to PDF |
| Spreadsheet with tables/data | Excel to PDF |
| Scattered JPGs to combine | JPG to PDF |
The common mistake is reaching for a screenshot-and-print workaround when the source is genuinely HTML — converting from the actual markup preserves real, selectable, searchable text, where a screenshot-based PDF is just a flattened image that can't be copied, searched, or read by a screen reader.
After You've Got the PDF
A freshly converted PDF is rarely the final step:
- Combine several converted pages into one document with Merge PDF.
- Number the pages of a multi-page report with Add Page Numbers.
- Reorder or drop pages with PDF Page Organizer.
- Lock a converted invoice or contract before emailing it — see How to Password Protect a PDF.
- Shrink the file size if the converted page included large images, with Compress PDF.
Quick FAQ
Will the PDF text be selectable and searchable, or is it an image? Selectable and searchable — converting from HTML preserves real text, unlike a screenshot-based PDF, which is just a flattened image no matter how sharp it looks.
Can I convert a page that requires a login? Only pages the converter can actually reach without authentication will render correctly — pages behind a login wall typically need to be saved as HTML first (from a logged-in session) and then converted from that file rather than the live URL.
Why does my converted PDF look different from the live webpage? Usually a CSS or timing issue — content that loads dynamically after the initial page load (lazy-loaded images, content injected by JavaScript after a delay) may not be present at the moment of conversion. Static, server-rendered content converts most reliably.
Is this the same as what invoicing software uses internally? Functionally yes — most "download as PDF" buttons in web apps are built on the same underlying idea: render an HTML template with real data, then convert that rendered HTML to PDF on demand.
Related Free Tools
- HTML to PDF — convert a URL, HTML file, or raw HTML code to PDF
- Word to PDF — for documents that started as Word files, not HTML
- Merge PDF — combine multiple converted pages into one file
- Compress PDF — shrink the file size of an image-heavy conversion
- Add Page Numbers — number the pages of a multi-page report