About the HTML to PDF
Convert HTML to PDF by pasting your markup into the box and clicking Generate PDF. It works well for invoices, receipts, email templates, certificates and simple reports that you've written or exported as HTML. What comes out is a set of A4 pages to print, attach to an email or keep on file.
Your browser draws the HTML into a PDF, and the markup is never uploaded. Scripts in it are switched off, so code pasted from somewhere else can't run on your device.
How the HTML is turned into PDF pages
Your HTML is placed in a hidden, sandboxed frame 794 pixels wide, which is the width of an A4 page on screen, with 32 pixels of padding, a white background and a plain sans-serif font unless your own styles say otherwise. Once laid out, it's captured as a picture at twice screen resolution, roughly 190 pixels per inch on the page.
That picture is cut into A4-sized slices from top to bottom, about 1,123 screen pixels of content per page, and each slice becomes one PDF page. Long content carries on over as many pages as it needs.
pages = content height in px (including 32 px top and bottom padding) ÷ 1,123, rounded up
Assumptions and limits
- Each page is an image, so text in the PDF can't be selected, searched or copied. For a text-based PDF, use Text to PDF or Word to PDF.
- Pages are cut at fixed heights, not between paragraphs, so a line of text or a table row can be split across two pages. Adding space before a section moves it onto the next page.
- Styles in a <style> block or style attributes are applied; JavaScript, including charts drawn by scripts, is not run.
- Images hosted on other websites may be left out because of browser security rules; images embedded as data URIs do appear.
- There's no web address box: to save a live webpage, copy its HTML source or use your browser's Print › Save as PDF.
Worked examples
Convert an HTML invoice to PDF
Paste an invoice built with a <table> and a short <style> block. A one-page invoice whose layout is 900 pixels tall fits on a single A4 page; the totals row and footer appear exactly as styled.
A long report across several pages
A report that lays out at 3,000 pixels tall plus 64 pixels of padding is cut into three A4 pages: two full slices and a shorter last page.
3,000 + 64 = 3,064 px 3,064 ÷ 1,123 = 2.73 → 3 pages
How to use the HTML to PDF
- Paste your HTML. Full pages or fragments both work; include a <style> block for fonts, colours and spacing.
- Click Generate PDF. The markup is laid out at A4 width and split into as many pages as it needs.
- Download the PDF. It's saved as document.pdf with the number of pages shown.
Frequently asked questions
Can I convert a webpage URL to PDF?
Not by typing the address. Open the page, view its source and paste the HTML here, or use your browser's Print and Save as PDF option for a live site. With pasted HTML you decide exactly what ends up on the page.
Why can't I select the text in my PDF?
Because each page is saved as a high-resolution picture of your layout. That keeps the design exactly as it looks in the browser, but the text isn't selectable. Use Text to PDF if you need real, searchable text.
Does CSS work when converting HTML to PDF?
Yes. Inline style attributes and <style> blocks are applied, including fonts available on your device, colours, borders, flexbox and grid. Styles that depend on JavaScript won't run, because scripts are switched off for safety.
How do I force a page break in HTML to PDF?
Use margin rather than CSS. The page-break and break-before rules aren't used, because the layout is cut into slices of equal height. To start a section on a new page, give the element before it enough bottom margin to push the section past the 1,123-pixel mark of the page.
Is my HTML sent to a server?
No. Your browser lays out the HTML and builds the PDF on your device. If the HTML links to images or stylesheets on other sites, your browser may request those files from them, just as it would when opening the page.
This tool runs entirely in your browser. What you enter or upload stays on your device and is never sent to our servers.