Turn HTML into a PDF, locally
Sometimes you just need a quick PDF of an HTML email, an invoice template, or a snippet of formatted content — without installing anything or trusting an upload service. This tool renders your pasted HTML in a sandboxed iframe and then uses the browser’s own print-to-PDF engine to save it. The rendering and the PDF generation both happen on your machine.
How it works
Your HTML is written into an iframe that has the sandbox attribute set
(scripts disabled, no navigation), so even untrusted markup renders safely. A
small print-friendly base stylesheet is injected so text wraps sensibly and
default margins are reasonable. When you click Save as PDF, the tool calls
window.print() scoped to the preview frame; your browser opens its native print
dialog where you select “Save as PDF” as the destination. The browser’s layout
engine — the same one that draws web pages — produces the PDF, so the output
matches the preview.
Tips and notes
- Use absolute
https://URLs for images so they resolve when the content is rendered on its own. - Put all styling inline or in a
<style>block; external stylesheet links may not load because the content has no base URL. - Page size, margins and whether browser headers/footers appear are controlled in the print dialog, not in the HTML — set them there before saving.
- For pixel-perfect, repeatable output (page breaks, running headers) consider
CSS
@media printrules and thepage-break-inside: avoidproperty in your markup.