Slate PDF

Converting

How to Convert HTML to PDF (With the Design Intact)

Render HTML and CSS to a PDF that looks like the page rather than a wall of unstyled text — including how to control page breaks.

April 29, 20262 min read

Converting HTML to PDF means one thing: the design has to be built first, then captured. A converter that reads your markup as text and prints it produces something technically correct and visually useless.

Convert HTML to PDF

  1. 1Open the HTML to PDF tool and paste your markup, or upload the .html file.
  2. 2Watch the live preview — that rendered view is what the PDF will contain.
  3. 3Adjust the markup or CSS until the preview looks right.
  4. 4Convert and download.

Rendering, not printing the source

A good converter runs your HTML through a real layout engine: CSS is applied, boxes are laid out, fonts are measured, and the finished page is captured. That is why the preview matters — if it looks right in the preview, it will look right in the PDF, because they are the same render.

What does not survive

FeatureIn the PDF
CSS layout, colours, typographyRendered as designed
Images referenced by URLIncluded if reachable; inline data URIs are safest
Web fontsApplied if they load — embed or fall back to system fonts
JavaScript-generated contentOnly if the script has run before capture
Hover and focus statesNot applicable — a page has no cursor
Video and interactive embedsReduced to a still frame or blank space

Controlling page breaks

A web page scrolls forever; a PDF has pages. Where the cut lands is decided by CSS, and a few properties give you control:

  • break-inside: avoid on a card or table row keeps it from being split down the middle.
  • break-before: page forces a new page — useful before each section heading.
  • Print styles in an @media print block let you hide navigation and adjust margins.
  • A repeating table header via thead makes long tables readable across pages.

Common uses

Invoices, certificates, reports and tickets are all HTML-to-PDF jobs: you build a template, fill it with data, and render. Doing the layout in HTML and CSS means the design lives in a language you already know rather than in a PDF drawing API.

Do it now

HTML to PDF

Convert web pages to PDF. It runs in this browser tab — your file is not uploaded anywhere.

Open HTML to PDF

Frequently asked questions

Why does my PDF look unstyled?+

The CSS did not reach the renderer. External stylesheets can fail to load — inline the styles in a style tag and convert again.

Can I convert a live website URL to PDF?+

This tool converts markup you provide. For a live page, use your browser's own Print to PDF, which renders the page exactly as you are seeing it.

How do I stop a table splitting across pages?+

Apply break-inside: avoid to the rows or to the table, and put the header in a thead so it repeats on each page.

Do web fonts work?+

If they load before capture. Safest is a system font stack, or the font embedded as a data URI in your CSS.

Keep reading