# Render HTML as a PDF

> Paste HTML into the editor or load an .html file, then render it to a PDF using html2canvas. Inline CSS works; external resources don't load.

Open the tool: https://yourbrowsercandoit.com/html-to-pdf

Paste HTML and render it to a PDF. Free, no signup. Runs entirely in your browser; files are never uploaded.

## How it works

The tool renders your HTML to an offscreen canvas via html2canvas at 2x scale, then embeds that canvas as a JPEG page in a fresh PDF. Choose page size (A4 portrait, US Letter, or Fit to content). Inline styles work: <h1 style="...">, <p style="...">, classes you define in <style> blocks, all fine. What doesn't work, on purpose: external CSS files, web fonts, remote images, third-party scripts. The renderer is configured with useCORS: false, so no cross-origin fetches happen. This is the privacy-by-default trade-off: HTML that pulls in https:// resources will render without them. For local privacy-respecting rendering of a single page of styled content, it's a clean fit. Output filename is html.pdf.

## How to use it

1. **Paste or load your HTML.** Type into the editor or load an .html file — inline CSS and <style> blocks work.
2. **Pick a page size.** Choose A4, US Letter, or Fit to content.
3. **Render.** html2canvas draws the HTML at 2x scale locally; external fetches are blocked by design.
4. **Download.** The rendered PDF downloads as html.pdf.

## Frequently asked questions

### Why don't my external fonts or images load?

By design. The renderer blocks cross-origin fetches so nothing about your HTML leaks to a third-party server. Inline base64 images and inline CSS work fine.

### Can I paginate long HTML across multiple PDF pages?

Not yet. The current renderer puts everything on a single page (or fits the content to one page). Long HTML may overflow.

### Is my HTML uploaded?

No. html2canvas renders inside your browser, pdf-lib builds the PDF locally.

### What CSS is supported?

Most common CSS works (typography, layout, colors, borders, shadows). Some advanced features like CSS grid edge cases and certain transforms may not render exactly. Test on small HTML first.

## Related tools

- [Merge PDFs](https://yourbrowsercandoit.com/merge-pdf): Combine multiple PDFs into one file.
- [Split PDF](https://yourbrowsercandoit.com/split-pdf): Click between pages to cut, split every N pages, or pull pages out.
- [Compress PDF](https://yourbrowsercandoit.com/compress-pdf): Shrink a PDF or fit it under a size limit, and compare before saving.
- [Rotate pages](https://yourbrowsercandoit.com/rotate-pdf): Turn pages the right way up. Sideways pages are found for you.
- [Extract pages](https://yourbrowsercandoit.com/extract-pages): Pull pages out as a new PDF.
- [Watermark PDF](https://yourbrowsercandoit.com/watermark-pdf): Add text or a logo, placed and previewed on the real page.
