Turn HTML into a PDF without uploading your markup
You can produce a PDF from HTML without sending your markup anywhere. One honest caveat: if the markup points at images, stylesheets or fonts hosted elsewhere, rendering it requests those in the normal way.
At a glance
- Tool
- /tools/html-to-pdf
- Input
- HTML markup
- Output
- Your markup
- Stays on your machine
- Remote references
- Images, styles and fonts named by a URL are requested as usual
- How to avoid that
- Embed images as data URIs and use fonts already on the machine
In detail
People render HTML to PDF to produce documents from a template they control: invoices, statements, certificates, delivery notes, reports. The markup is filled with real customer names and real amounts by the time it is worth converting, which makes pasting it into a hosted renderer a transfer of exactly the records you were being careful with.
This is the one page in this cluster with a real caveat, and it should be said plainly. Your markup is not uploaded. But a document that references an image, a stylesheet or a font by URL causes those to be fetched while it renders, and a fetch tells the host serving them that someone loaded your document. If the requirement is a document produced with no outbound requests at all, inline the images as data URIs and use locally available fonts.
Screen layout and page layout are different problems. A page has fixed edges and hard breaks, so long tables split, floated elements land in unexpected places, and backgrounds behave differently from how they look on screen. Produce the PDF and read it as a document, then adjust the markup rather than the expectations.
The network panel is unusually useful here, because you are not just confirming an absence. Render, look at the requests, and check that every one of them corresponds to a URL you can point to in your own markup. Anything you cannot account for is something to remove from the template.
Examples
Replace: <img src="https://example.com/logo.png">
With: <img src="data:image/png;base64,...">
Replace: a linked remote font stylesheet
With: a font stack of families already present on the machine
Then render and confirm the network panel shows no outbound requests.Things that catch people out
- Remote images, fonts and stylesheets are fetched while the document renders. Inline them if that matters to you.
- Interactive elements do not survive into a PDF. Only the rendered result does.
- What fits on screen does not necessarily fit on a page. Check where long tables and lists break.
Try it: Hash Generator
The file hasher is on every page here because it takes any file at all and proves the point: disconnect from the network, drop a file in, and it still returns a checksum you can compare against a published one.
Hash Generator
LOCAL · Browser-OnlyGenerate MD5, SHA-1, SHA-256, SHA-384, SHA-512, SHA3-256, SHA3-512, Keccak-256, CRC32, and HMAC hashes from text or files
MD5 is cryptographically broken and should not be used for security purposes. Use SHA-256 or SHA-512 instead.
Related Working without uploading
All working without uploading →Convert a Word document to PDF without uploading it
Turn a .docx into a PDF in your browser. What a .docx stores about its authors, and what to check on the PDF before you send it.
Minify JavaScript without uploading your source
Minify scripts and stylesheets in your browser. Source carries comments, endpoints and internal names, and minifying is not obfuscation.
Convert SVG to PNG without uploading the file
Rasterise an SVG to PNG, JPEG or WebP in your browser. Why an SVG is a text file that usually carries layer names and editor metadata.
Compress images without uploading them
Shrink pictures in your browser with five presets. What each preset does, and the two formats the compressor will not accept at all.
Resize images without uploading them
Resize to exact pixels, a percentage or a preset in your browser. The 8192 pixel and 32 megapixel ceilings, and what to check afterwards.
Crop an image without uploading it
Crop to a free or fixed ratio in your browser, with rotation and flips. Why cropping genuinely removes pixels but never removes EXIF.
Tools for this
- HTML to PDF Converter Convert HTML to PDF online free - create downloadable PDF documents from HTML code in your browser
- Code Formatter Free online code formatter - beautify and format JavaScript, CSS, HTML, and more
- Image to Base64 Free online image to base64 - convert images to Base64 encoded strings for embedding in code