HTML to PDF
Convert HTML code to PDF using the browser print API.
HTML to PDF turns markup you paste into a downloadable PDF using only the browser print stack. Choose A4 or Letter, type or paste HTML, optionally Preview it in a sandboxed iframe, then Save as PDF and pick the destination in the print dialog. Base print CSS (system fonts, tables, images, code blocks) is injected for you.
No server, no rendering service — Local Processing means data stays on the machine. Great for receipts, simple layouts, or emailing a fragment of a page as PDF.
How it works
The textarea holds your HTML in Redux. Preview toggles an iframe with srcDoc (sandbox allow-scripts allow-same-origin) so you can check structure before printing.
Save as PDF opens a window, writes your HTML plus a stylesheet (@page size a4|letter, 15mm margin, 12pt body, max-width images, bordered tables, pre-wrap code) and calls window.print() after 300ms. You select Save as PDF as the printer destination.
How to use
- Open HTML to PDF (steps: Input → Preview → Download).
- Select Page Size: A4 (default) or Letter.
- Paste your markup into HTML Input (placeholder shows a simple h1/p example).
- Click Preview to load the sandboxed iframe; Hide Preview when done.
- Optionally Clear to start fresh (state also lives in the editor).
- Click Save as PDF and allow the pop-up if blocked.
- In the print dialog confirm page size/margins and Save as PDF.
- Your file downloads with a name you choose in the dialog.
Tips
- Preview first — what you see in the iframe is what print CSS will style.
- External images/scripts need network access to appear in the print window.
- Page size is fixed in @page (15mm margin); tweak margins in the print dialog if needed.
- Allow pop-ups or Save as PDF fails with an explicit error toast.
HTML to PDF FAQ
Does it need a server?
No. The page states Local Processing — no data is sent to any server.
Which page sizes are supported?
A4 and Letter, selected before save and applied via @page CSS.
Can I use external CSS or JS?
Yes in principle via links/scripts in your HTML, but they must be reachable from the print window (network required).
Why do I see a print dialog?
Output uses the browser Print API; choose Save as PDF as the destination to get a file.
Is my HTML stored on your side?
No — it lives in local client state only for the session.
Credits
- Browser Print API — window.print() with @page CSS for PDF export