SwitchPDF

HTML to PDF

Convert web pages or HTML code to PDF. Enter a URL or paste HTML directly.

Convert a webpage URL or raw HTML to PDF. Powered by Puppeteer (headless Chrome), so the output renders the page exactly as Chrome would — CSS, web fonts, images, and all. Useful for archiving articles, generating reports from web apps, or producing printable receipts.

The page must be publicly accessible. JavaScript-heavy pages may not render perfectly.

How HTML to PDF works

Converting HTML to PDF means rendering the HTML document — with all its CSS, web fonts, JavaScript-generated content, and embedded images — and capturing the rendered output as a paginated PDF. SwitchPDF uses Puppeteer, which is a headless Chrome browser controlled programmatically. Chrome opens the URL or the raw HTML, waits for fonts and images to load, executes any JavaScript (within a safe sandbox), and then exports the rendered page using Chrome's built-in "Save as PDF" function.

This produces the highest-fidelity HTML-to-PDF output of any free tool because it uses the actual Chrome rendering engine. Server-side libraries like wkhtmltopdf or older versions of weasyprint render HTML through their own implementations, which often diverge on modern CSS features (flexbox, grid, web fonts, CSS custom properties). With Puppeteer, anything that works in Chrome works in the PDF — including modern CSS Grid layouts, Google Fonts, and gradients.

For URL inputs, we fetch the page over HTTPS and load it in Chrome's sandbox. The page sees a real browser, so JavaScript-rendered single-page apps (React, Vue, Svelte) render correctly. For HTML inputs you paste in, the same rendering pipeline runs against the raw markup. CSS @page rules for paper size and margins are respected, so you can control pagination from your HTML.

Common use cases: archiving blog articles in a permanent format; generating printable receipts or invoices from a web app; turning a custom-styled HTML email into a PDF for sharing; capturing rendered reports from internal dashboards.

How to use HTML to PDF

1

Enter a URL or paste HTML

Type a public webpage URL (e.g. https://example.com/article) or paste raw HTML source code.

2

Configure (optional)

Choose paper size, orientation, margins, and whether to include the page background. Defaults work for most cases.

3

Convert and download

Click "Convert to PDF" — Chrome renders the page server-side and produces the PDF. Download the result.

Frequently Asked Questions

Will JavaScript be executed?
+
Yes. We use headless Chrome, so JavaScript runs and dynamic content renders. Single-page apps (React, Vue, etc.) work correctly.
Are web fonts supported?
+
Yes. Google Fonts, Adobe Fonts, and any @font-face declaration loaded over the public internet will render correctly in the PDF.
Can I convert pages that require login?
+
No. We render in a fresh Chrome instance with no cookies or session. For authenticated pages, save the rendered HTML locally and paste it as raw HTML input.
What paper sizes are supported?
+
A4, Letter, Legal, Tabloid, plus custom sizes via @page CSS rules.
Can the page background be included?
+
Yes. Toggle "include background" to render CSS background colors and images. Default is off to match the browser's "Print" behavior.
How long does conversion take?
+
Typically 3–8 seconds — the page loads in headless Chrome, waits for fonts and images, then exports. Heavy single-page apps may take longer.
Can I add headers and footers?
+
Yes. Use CSS @page { @top-center { content: "My Header" } } or pass header/footer HTML in the converter options.
Is HTML to PDF free?
+
Yes. Limited to 10 conversions per 15 minutes per visitor since headless Chrome is resource-intensive.

Related tools