HTML to PDF

Turn HTML code or a web page into a clean, paginated PDF — right in your browser.

Scripts in the HTML are never run — it's rendered in a locked-down sandbox.

Live preview
Page size
Margin

How to Convert HTML to PDF

Web pages are built for screens, but sometimes you need a fixed, shareable document: an invoice generated as HTML, an email template to archive, a report to attach, or a page to keep exactly as it looked on a certain day. HTML to PDF conversion captures the layout, fonts, colors, and images and splits them into neat pages. PDFDoco does it right in your browser — paste HTML or load a page, check the live preview, and download.

  1. 1

    Add your HTML

    Paste HTML and CSS, or load a web page that allows cross-site access.

  2. 2

    Preview the layout

    See it rendered live at desktop, tablet, or mobile width.

  3. 3

    Choose page settings

    Pick A4 or Letter and the margin you want around the content.

  4. 4

    Convert

    Download a paginated PDF, or print to PDF for selectable text.

Safe sandbox

HTML is rendered with scripts disabled, so pasted code can't run.

Smart page breaks

Breaks are placed in blank space where possible, so lines aren't cut in half.

No upload

Your HTML is rendered and converted locally on your device.

Invoices, receipts, and emails

Many apps produce documents as HTML: invoice systems, e-commerce order confirmations, newsletters, and transactional emails. Converting them to PDF gives you a tidy record for accounting, a file you can attach to a support ticket, or an archive copy that will look the same years from now — no matter how the original website changes.

Choosing a viewport width

Modern websites change their layout depending on screen size. The viewport setting decides which version you capture: Desktop renders the full multi-column layout, Tablet a medium layout, and Mobile the narrow single-column version, which often produces larger, easier-to-read text in the PDF. The content is then scaled to the page width you choose.

Image-based vs. print-based conversion

Convert to PDF captures the rendered page as high-resolution images, so the PDF looks exactly like the preview on every device. Print / Save as PDF uses your browser's built-in print engine instead, which keeps text selectable and searchable but follows the page's print styles. Use the first for visual fidelity and the second when you need to copy or search the text.

Why some URLs can't be loaded

For security, browsers don't let one website read another website's pages unless that site explicitly allows it (a rule called CORS). Most sites don't, so loading by URL only works for some pages. That's not a limitation you can work around safely from a browser — instead, open the page yourself and use Print → Save as PDF, or view its source and paste the HTML here.

Pro tip: inline your CSS in a <style> block and use absolute image URLs. Self-contained HTML renders most reliably and looks identical in the PDF.

Frequently Asked Questions

Can I convert any website by URL?

Only websites that allow cross-site access can be loaded from your browser, and most don't for security reasons. For other sites, open the page and use your browser's Print → Save as PDF, or paste the page's HTML source here.

Does JavaScript run when converting?

No. HTML is rendered in a sandbox with scripts disabled. That keeps you safe when converting code you didn't write, but content that relies on JavaScript to appear won't be shown.

Will the text in my PDF be selectable?

The Convert to PDF button creates an image-based PDF that looks exactly like the preview. If you need selectable, searchable text, use Print / Save as PDF instead.

Why are some images missing?

Images hosted on other websites only appear if those servers allow cross-site loading. Use images from your own site, data URLs, or a hosting service that supports CORS.

How are page breaks decided?

The content is split to fit your page size, and each break is moved to the nearest blank row so lines of text aren't cut in half.

Is my HTML sent to a server?

No. Rendering and PDF creation happen entirely in your browser.