HTML to PDF Converter
Turn raw HTML markup into a paginated PDF with a live preview, custom margins, headers, footers, and page numbers. Renders your HTML safely in a sandboxed frame before conversion.
How This HTML to PDF Converter Works
This tool loads your HTML markup into a sandboxed iframe, both for a live preview as you type and for the final render, so it displays exactly the way a real browser would, including any inline styles or style tags you provide. Once rendered, html2pdf.js walks through the content page by page and rasterizes it into a genuine, paginated PDF using html2canvas and jsPDF.
After the base PDF is generated, the tool makes a second pass over every page to stamp on your custom header text, footer text, and page numbers, giving you a finished document that looks like it came from a proper page layout engine, not a rough print to PDF screenshot.
What This Tool Does
How to Convert HTML to PDF
Choose your source
Paste raw HTML, or switch to the From URL tab.
Set page options
Pick page size, orientation, margin, and scale.
Add header or footer text
Optional, appears on every page along with page numbers.
Convert and download
Click Convert to PDF and save the finished document.
HTML Input Examples
This converter accepts full HTML fragments, including inline CSS and style tags. A couple of examples of markup that convert cleanly.
<div style="padding:20px;background:#f5f5f5;">
<h2>Invoice #1042</h2>
<p>Amount due: $420.00</p>
</div>Inline styles are preserved exactly as written since the rendering pass uses a real browser engine.
<table>
<tr><th>Item</th><th>Qty</th></tr>
<tr><td>Widget</td><td>3</td></tr>
</table>Tables, including borders and cell padding defined in a style tag, render and paginate correctly.
FAQ: HTML to PDF Converter
Switch to the From URL tab and paste the page address. The tool will attempt to load it inside a sandboxed frame. Some sites set headers that block being embedded this way, in which case pasting the page HTML directly is the reliable option.
Yes. Both inline styles and style tags included in your HTML render exactly as a browser would display them, since the conversion uses an actual browser rendering pass rather than a simplified parser.
Yes. Enter text in the Header Text and Footer Text fields in Page Settings, and leave Add Page Numbers checked. All three are stamped onto every page of the resulting PDF.
Your markup is rendered inside a sandboxed iframe with scripting restricted, so the tool focuses purely on visual layout, fonts, colors, and structure, rather than running arbitrary code.
No. Rendering and PDF generation both happen locally in your browser. The only exception is if you choose the From URL option, which asks your own browser to load that address directly.