HomeFile Converter ToolsHTML to PDF
H→PDF
File

HTML to PDF Converter

Convert HTML to PDF using html2pdf.js (html2canvas + jsPDF). Paste HTML or upload a .html file. Live preview shows the rendered HTML before conversion. Choose page size and margin. Note: output is rasterised — text is not selectable in the PDF.

🖼 html2pdf.js engine👁 Live HTML preview📐 Page size & margin⚠ Rasterised output
Office Tools:
🔒 100% Private — All conversion runs in your browser. Files never leave your device.
⚠️ Note: Output is a rasterised image PDF — text is not selectable. Best for simple HTML. Complex CSS (grid/flexbox) may not render correctly.
HTML Input
Live Preview

📖 How to Use HTML to PDF

  1. 1
    Paste or upload HTML

    Paste raw HTML into the input area or upload a .html file. The live preview panel renders the HTML immediately — check that styles and images display correctly before converting.

  2. 2
    Set PDF options

    Choose page size (A4 or Letter), margin, and image quality. Note that html2canvas renders HTML to a canvas image — complex CSS (grid, flexbox, sticky) may not render perfectly. Simple content converts reliably.

  3. 3
    Generate and download PDF

    Click Convert to PDF. html2canvas captures the rendered HTML as a canvas image, which jsPDF embeds into a PDF page. The PDF is generated entirely in your browser and downloads automatically.

💡 Quick Reference

HTML feature PDF result
Text Rasterised image (not selectable)
Images Captured in render
Complex CSS May not render
Page breaks Auto by content height

Frequently Asked Questions — HTML to PDF

Why is the text not selectable in the PDF?

html2pdf.js works by rendering your HTML to a canvas image using html2canvas, then embedding that image in a PDF using jsPDF. The result is a rasterised image — pixels, not text characters. This means text cannot be selected, copied, or searched in the PDF. For PDFs with selectable text, server-side tools like Puppeteer, wkhtmltopdf, or WeasyPrint are required — they use real browser rendering engines and preserve text layer.

What HTML features does html2canvas support?

html2canvas renders a snapshot of the visible page similar to a browser screenshot. It supports: standard HTML elements (divs, headings, paragraphs, tables, images), inline and external CSS for most properties, web fonts (with CORS restrictions), and basic transforms. It does NOT support: CSS Grid (partial), position: sticky (partial), SVG background images (limited), CSS custom properties in some cases, and cross-origin images without CORS headers.

Why does my PDF look different from the browser?

Several factors cause visual differences: html2canvas uses a different rendering pipeline than the browser. Fonts that are not embedded may fall back to system defaults. External resources (images, CSS, fonts) must be accessible for html2canvas to load them — local files and cross-origin resources without CORS may not render. Scale/DPI mismatches can cause slight size differences.

When should I use a server-side tool instead?

Use a server-side tool when: text must be selectable in the PDF, the document has complex multi-page layouts, you need PDF/A compliance, the document has complex CSS (grid, flexbox, animations), you need to generate many PDFs programmatically, or file size must be small (rasterised PDFs are much larger than text-based PDFs). Server options: Puppeteer (Node.js), wkhtmltopdf, WeasyPrint (Python), or Playwright.

Can I convert a webpage URL to PDF?

This tool converts HTML code — paste the page's HTML source or upload an .html file. It does not fetch URLs directly (cross-origin restrictions prevent this in browsers). To convert a live webpage: use the browser's built-in print to PDF (Ctrl+P > Save as PDF) which produces text-based PDFs, or use server-side Puppeteer which can navigate to URLs.

How do I get the HTML source of a webpage?

In Chrome/Firefox: right-click the page > View Page Source (or Ctrl+U), then select all and copy. Or: press F12, go to Elements tab, right-click the <html> element > Copy > Copy outerHTML. Note that dynamically rendered content (React, Angular, Vue) is better captured from the Elements panel than View Source, which shows the original HTML before JavaScript runs.