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.
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.
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.
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.
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.
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.
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.
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.
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.
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.