User Rating 0.0
Total Usage 0 times
Inline CSS and base64 images for best results.
PDF Settings
80%
Is this tool helpful?

Your feedback helps us improve.

About

Converting HTML to PDF is a document-encoding problem, not a rendering problem. Browsers render HTML natively, but encoding that render into the ISO 32000 PDF specification requires constructing a binary stream with cross-reference tables, content streams, and font embedding metadata. Getting this wrong produces corrupt files that fail silently in some readers, break print workflows, or lose text selectability. This tool parses your HTML input, renders it to a pixel-accurate raster via a headless canvas pipeline, then encodes each page tile into a standards-compliant PDF with configurable page size (W × H in mm), margins, and orientation. It approximates screen rendering; CSS features like @media print rules in your source HTML are not evaluated. Complex layouts with floats, fixed positioning, or web fonts may deviate from browser output.

html to pdf convert html pdf generator html converter document converter pdf export html file to pdf

Formulas

The rendered HTML is rasterized at a configurable scale factor s, then sliced into page-sized tiles. Each tile height in pixels is derived from the physical page dimensions minus margins:

htile = (Hpage mtop mbottom) × s × 9625.4

where Hpage is the page height in mm, mtop and mbottom are top and bottom margins in mm, 96 is the CSS reference pixel density in dpi, and 25.4 converts mm to inches. The total number of pages is:

N = ceil(Hrenderedhtile)

where Hrendered is the total pixel height of the fully rendered HTML content. Each tile is drawn onto an intermediate canvas, exported as JPEG with quality factor q [0.1, 1.0], then embedded into a PDF page object stream.

Reference Data

Page FormatWidth (mm)Height (mm)Width (in)Height (in)Common Use
A329742011.6916.54Posters, engineering drawings
A42102978.2711.69Standard documents (ISO)
A51482105.838.27Booklets, flyers
Letter215.9279.48.511Standard documents (US/CA)
Legal215.9355.68.514Legal contracts (US)
Tabloid279.4431.81117Newspapers, large spreadsheets
Executive184.15266.77.2510.5Memos, executive letters
B4 (ISO)2503539.8413.90Envelopes, maps
B5 (ISO)1762506.939.84Books, magazines
Statement139.7215.95.58.5Half-letter, invoices
DL Envelope1102204.338.66Standard mailing envelopes
C5 Envelope1622296.389.02A5 sheet mailing

Frequently Asked Questions

The converter rasterizes HTML using an offscreen canvas, which does not execute JavaScript, load external resources from cross-origin domains, or apply @media print CSS rules from your source. Web fonts that are not loaded at render time fall back to system fonts. For best fidelity, inline all CSS and convert images to base64 data URIs before conversion.
The practical limit depends on browser memory. Canvas elements have maximum dimension limits (typically 16,384 × 16,384 pixels in Chrome, 32,767 × 32,767 in Firefox). Very long HTML documents exceeding roughly 50,000 pixels in rendered height may fail. Split large documents into sections if you encounter blank pages or errors.
Each page is encoded as a JPEG image embedded in the PDF. Quality factor q = 1.0 produces near-lossless images at 2-5 MB per page. Quality q = 0.5 reduces this to roughly 200-500 KB per page with minor visual artifacts. For text-heavy documents, q = 0.8 offers a good balance. Note that because pages are rasterized, text in the PDF is not selectable or searchable.
Browser security (CORS policy) prevents fetching arbitrary URLs from client-side JavaScript. You can manually save a webpage as a complete .html file (Ctrl+S in your browser), then upload that file to this tool. Alternatively, paste the page's source HTML directly into the text editor. External images and stylesheets referenced by relative paths will not load.
No. The conversion pipeline rasterizes HTML to pixel images, which means all interactive elements (links, forms, buttons) are flattened into static images. If you need clickable links in your PDF, use a server-side tool like wkhtmltopdf or Puppeteer, which can produce vector-based PDFs with live annotations.
Blank pages typically occur when the rendered content height is just barely over a page boundary, creating a nearly empty overflow tile. This can also happen if your HTML has large bottom margins or padding. Adjust the page margins in the settings or reduce whitespace in your HTML source.