What is HTML to PDF?

Converts HTML markup into a downloadable PDF. Supports CSS styles, images, tables, and custom page sizes. Works well for invoices, reports, or saving formatted web content offline.

Pick A4, A3, Letter, or Legal paper, switch between portrait and landscape, and set margins from none up to 20 mm. Optionally lock the file with a password or stamp page numbers in the footer. Inline CSS, base64 images, and tables all render in the output. The conversion runs through html2pdf.js which uses html2canvas, so a complex page with web fonts may render slightly differently than the live preview.

How to use

  1. Step 1 — Paste or type your HTML content in the editor. The live preview shows exactly how the PDF will look.
  2. Step 2 — Configure page settings: choose paper size (A4, A3, Letter, Legal), orientation (portrait/landscape), and margins. Optionally set a password or add page numbers.
  3. Step 3 — Click 'Generate PDF' to create the document, then download it directly to your device.

When to use

  • Generating an invoice or receipt from an HTML template before emailing the client.
  • Saving a styled report (charts, tables) as a portable archive copy.
  • Producing print-ready handouts from web content for a workshop or class.

Result

A freelancer pastes their invoice HTML with a company logo, itemized table, and totals. They set A4 portrait with 20mm margins and download a professional PDF to email to their client.

FAQ

Why does my PDF look different from the live preview?
The PDF is rasterized through html2canvas, which paints the page once into an image and then wraps it in a PDF. Web fonts that aren't fully loaded, fixed-position elements, and CSS filters can render slightly differently than the live preview.
Can I include images hosted on another domain?
Only if the host sends a permissive CORS header. Without one, the image will be blank in the PDF because html2canvas can't read its pixels. Workarounds: download the image and embed it as base64, or host it on the same origin.
How do I control page breaks?
Add the CSS rule page-break-before: always (or page-break-after) to any element where you want a new page to start. For tables, page-break-inside: avoid on a row keeps it intact across pages.
Does the PDF have selectable text?
Partially. Because the renderer flattens the page through canvas, blocks of text become bitmap images. Some users embed an invisible text layer for selection, but this tool produces image-rasterized PDFs — readable, but not always copy-able.
Is there a size limit for the HTML I can paste?
Practical limit is a few hundred KB of markup or roughly 10–15 pages. Very long pages can run out of memory because the entire DOM is rasterized into one canvas before being split into pages.

Related Tools