HTML to PDF turns an HTML file or pasted HTML code into a clean PDF. Drop a .html file onto the upload card or paste code directly, review the live preview, choose page size, orientation, margin, scale and background colour, then press Convert to PDF. The tool renders the HTML in a hidden iframe, captures it with html2canvas, slices it into page-sized chunks and writes the PDF with jsPDF. Nothing is uploaded, no signup is needed, and the process works on phones, tablets and computers.
What is an HTML to PDF converter?
An HTML to PDF converter takes a web page, an HTML file or raw HTML code and turns it into a fixed-layout PDF. HTML is designed to flow: the browser reflows text to fit the window, wraps long lines, hides elements on small screens and reloads fonts on demand. A PDF is designed to stay the same. Once the file is saved, every reader sees the same page breaks, the same table columns and the same margins.
People search for “html to pdf” because they need to archive an invoice, save a receipt, print a report, send a resume, share documentation or capture a specific web layout. Browsers already include a “Save as PDF” print command, but it does not let you choose the exact page size, scale or background, and it can break when the page uses fixed-width layouts. This tool gives you those controls.
The PDF format is an open standard published as ISO 32000. You can read its background in the Wikipedia article on PDF, and the story of HTML in the HTML article. The HTML-to-PDF pipeline uses html2canvas for rendering and jsPDF for PDF output.
How to convert HTML to PDF in 4 steps
The tool follows a simple path. You never need to install software or create an account. Follow these steps for a clean result on your first try.
- Add your HTMLDrag an .html or .htm file onto the upload card, click Browse, paste HTML code directly, or import from Google Drive or Dropbox. The file is read locally with no uploads.
- Edit and previewThe editor shows the raw HTML on the left and a live iframe preview below it. Type, paste, or press Format to re-indent the markup. The preview updates as you type.
- Choose page settingsPick page size (A4, Letter, A3, A5, Legal, Tabloid), orientation, margin, scale and background colour. Toggle print styles, external resources, page numbers and the timestamp footer.
- Convert and downloadClick Convert to PDF and watch the progress circle as the page is rendered with html2canvas and sliced into A4 pages. Then download the file or start a new conversion.
A short page converts in a few seconds. A page with many images or long content takes longer because the browser has to render everything to canvas and slice it into page-sized pieces. Keep an eye on the progress circle for live status, and stay on the page until the download button appears.
Everything the converter can do
Beyond basic conversion, the tool packs the controls that people normally pay for. This table lists each setting, its options, and the effect you can expect.
| Setting | Options | What it does |
|---|---|---|
| Input source | File, paste, Drive, Dropbox | Drop an .html file, paste code, or import from cloud storage. |
| Live preview | Auto updates on typing | Shows the page exactly as the browser would render it. |
| Format button | Re-indents markup | Cleans up HTML that was pasted as one long line, with two-space indentation. |
| Page size | A4, Letter, A3, A5, Legal, Tabloid | Sets the paper size for every page. |
| Orientation | Portrait, Landscape | Rotates the page to suit wide tables, dashboards or code. |
| Margin | 0 to 30 mm | Adds white space around the content for printing. |
| Scale | 75%, 100%, 125%, 150% | Widens or narrows the rendered content width, which changes how much fits on each page. |
| Background colour | Six presets | Paints the page background behind the content. |
| Inject print styles | On or off | Removes body margins, styles tables, wraps long words and scales images. |
| Disable external resources | On or off | Strips scripts, link tags and iframes before rendering. |
| Page numbers | On or off | Prints "Page X of Y" at the bottom of each page. |
| Timestamp footer | On or off | Prints the conversion date and time at the bottom left. |
Once the PDF is ready, edit it with our PDF editor, lock it with protect PDF, or merge it with other files using merge PDFs.
Page sizes and orientation explained
Choosing the right page size prevents tiny text and awkward margins. Most of the world uses the ISO 216 “A” series. The United States and Canada use Letter and Legal, and Tabloid is common for posters, charts and large printouts.
| Size | Millimetres | Inches | Best for |
|---|---|---|---|
| A5 | 148 × 210 | 5.83 × 8.27 | Short documents, notes, receipts |
| A4 | 210 × 297 | 8.27 × 11.69 | Default for reports, invoices, resumes |
| A3 | 297 × 420 | 11.69 × 16.54 | Wide tables, dashboards, diagrams |
| Letter | 216 × 279 | 8.5 × 11 | US and Canadian printing |
| Legal | 216 × 356 | 8.5 × 14 | Legal filings, long lists |
| Tabloid | 279 × 432 | 11 × 17 | Posters, large charts, blueprints |
Orientation works the same way across sizes. Choose Landscape when the HTML contains wide tables, code blocks or dashboards. Choose Portrait for reading-oriented content like invoices, articles and documentation. If you convert a web page with a fixed-width layout, use scale 75% with landscape A3 to fit it without cropping.
Why convert HTML to PDF?
People convert HTML to PDF every day, and the reasons go beyond tidiness. A PDF opens the same on any device, so the reader sees exactly what you intended. These are the most common situations.
Invoices and receipts
Save HTML invoices as fixed-layout PDFs that customers can open without a browser and archive for tax records.
Resumes and applications
Convert HTML resumes to PDF before uploading to job portals that reject HTML or reject dynamic pages.
Documentation and guides
Turn HTML documentation into printable PDFs for offline reading, training, or user handbooks.
Reports and dashboards
Capture report snapshots and dashboards as PDFs for meetings, sign-off and compliance audits.
eBooks and articles
Save a single article or a full HTML book as a PDF for reading on eReaders or phones.
Archiving web pages
Capture a page at a point in time for legal, research or journalistic purposes when the page may later change.
After conversion, continue the workflow with merge PDFs to combine multiple reports, or compress PDF to shrink email attachments.
Your HTML stays private
Privacy matters because HTML often contains sensitive data: customer information, financial statements, internal reports, contracts and personal resumes. This converter runs entirely in your browser. The tool renders the HTML in a sandboxed iframe on your device, captures it with html2canvas, and writes the PDF with jsPDF. Neither library sends anything to a server.
- Local processing. The conversion code runs on your device, which also makes it fast on a good connection and usable on slow ones once the page has loaded.
- Direct cloud downloads. When you import from Google Drive or Dropbox, your browser fetches the file straight from that provider after you grant access.
- No account needed. You can convert without logging in. Read our privacy policy for full details about the site.
How the renderer works
Browsers already have a built-in print-to-PDF pipeline, but it cannot be controlled from JavaScript. This tool takes a different approach: it renders the HTML in a hidden iframe, captures the entire page as a canvas, and slices that canvas into page-sized chunks that are placed one per PDF page.
| Stage | What happens |
|---|---|
| 1. Preparation | The HTML is wrapped in a full document if it is not already one, external resources may be stripped, and a base CSS is injected for print-friendly styling. |
| 2. Iframe render | A hidden iframe is created offscreen with the target width, the HTML is loaded, and images and fonts are given time to finish. |
| 3. Capture | html2canvas snapshots the body at 2x scale, producing a high-resolution canvas of the full content. |
| 4. Slicing | The canvas is cut into page-sized chunks that match the content height of the chosen page size and margin. |
| 5. PDF assembly | jsPDF places each slice on its own page, adds page numbers and the timestamp footer, then exports the blob. |
Tip: use scale 75% with A3 landscape when rendering wide fixed-width layouts. That combination is roughly equivalent to a 1280-pixel-wide desktop view compressed into a print-friendly sheet.
Images, fonts and external resources
Images and fonts are the two biggest sources of conversion issues. Remote images load from their URLs, which means the conversion depends on the network and the image server. Fonts load from their stylesheet, and some fonts are blocked by the same-origin policy. Here is how the tool handles each case.
- Base64 images. Always work, because they are embedded in the HTML.
- Remote images. Work when the server allows cross-origin requests. If the server blocks them, the image appears blank or missing.
- Google Fonts. Usually work, because Google Fonts sends CORS headers. If the font does not load, the browser falls back to Arial or Helvetica.
- Custom web fonts on other servers. Sometimes blocked. Turn on Disable external resources to strip them and use a safe fallback.
- Scripts and widgets. Stripped when Disable external resources is on. Otherwise, they run inside the iframe during rendering.
Tips for the best PDF results
- Use the preview first. If the preview shows broken images or missing content, the PDF will too. Fix the HTML before converting.
- Use A4 with 20 mm margins for a reliable default. That combination works for invoices, reports, resumes and articles.
- Switch to landscape for wide tables. It gives you up to 40 percent more horizontal room than portrait.
- Reduce scale for fixed-width pages. A page designed for a 1280-pixel desktop looks best at 75% scale on A4 or A3.
- Keep Inject print styles on. It cleans up margins, wraps long words and scales images, which avoids clipped text.
- Turn on Disable external resources for problem pages. Strips scripts and third-party widgets that can break the render.
- Base64 images are safest. If the conversion keeps dropping images, inline them as data URLs in the HTML.
- Preview before you share. A short conversion confirms the file looks right; you can always re-convert with different settings.
Common problems and quick fixes
Most conversion problems come from a handful of causes. Check this list before you start over, because each fix takes only a few seconds.
| Problem | Likely cause | Fix |
|---|---|---|
| Content is cut off on the right | The page uses a fixed-width layout wider than the content area. | Reduce scale to 75%, or switch to A3 landscape. |
| Images are missing | The image server blocked cross-origin requests. | Download the images and inline them as base64 data URLs in the HTML. |
| Fonts look different | A custom web font failed to load. | Use a system font like Arial or Helvetica in the HTML, or leave fonts on remote CORS-enabled servers. |
| Text is blurry | The html2canvas scale is too low for the target page. | Reduce scale in the settings, which produces a larger image on the same page width. |
| JavaScript widgets are blank | They never finished loading inside the iframe. | Add a short setTimeout before conversion, or turn on Disable external resources. |
| PDF is very large | Many high-resolution images on one page. | Compress the images in the HTML, or split into multiple shorter conversions. |
| Cloud import fails | The sign-in window was blocked or closed. | Allow pop-ups for this site, then press the Drive or Dropbox button again. |
If a page still fails, save it to disk with the browser (Ctrl+S or Cmd+S), then drop the saved .html file here. The saved file contains all the assets locally and eliminates the remote-resource problems.
HTML, MHTML and PDF compared
Web pages can be saved in several formats. This tool converts HTML to PDF, which is the most universal and most archival format.
| Format | Notes | Convert to PDF here? |
|---|---|---|
| HTML | Web source. Smallest files, but requires a browser to view. | Yes |
| MHTML | Single-file HTML with embedded assets. Great for archiving a page. | No — open it in a browser first and save as HTML, then use this tool. |
| Universal, fixed-layout, archival. | Already PDF | |
| DOCX | Editable document format. | Use the Word to PDF tool. |
For DOCX files, use the Word to PDF tool. For EPUB files, use the EPUB to PDF tool. For images, use JPG to PDF, PNG to PDF or AVIF to PDF.
Related PDF tools
A good document workflow often needs more than one step. These tools work well after HTML to PDF, and all of them are free.
You can also read practical guides on our blog, or learn more about the team on the About page.
Frequently asked questions
Is the HTML to PDF converter free?
Does the tool upload my HTML to a server?
Which page sizes are supported?
How does the live preview work?
What is the scale option for?
What does Inject print styles do?
What does Disable external resources do?
Can I add page numbers and a timestamp?
Does it work on iPhone and Android?
Can I convert a live webpage URL?
Why are images sometimes missing?
Can I edit the PDF after conversion?
Ready to turn your HTML into a PDF?
Drop an HTML file or paste code, review the preview, and download a clean PDF in seconds. Free, private and built for every device.
Convert HTML now