Skip to content

HTML to PDF converter

HTML to PDF uses a document engine chain that reads semantic HTML and does not run browser JavaScript or apply full stylesheets.

  • Converted with Document engine → PDF renderer · input deleted within 24 h
  • Free: 5 conversions a day · 5 MB each
  • Higher limits →

From real runs

What you get — and what changes

  • Semantic headings Kept

    h1 through h6 elements become PDF headings and can feed a table of contents.

  • Paragraphs and lists Kept

    Basic HTML text, lists, blockquotes, and tables are converted through our document engine's document model.

  • CSS Lost

    Stylesheets are mostly ignored because our PDF renderer renders semantic content, not a browser layout tree.

  • JavaScript Lost

    JavaScript never runs, so client-rendered content is absent unless it is already present in the HTML source.

  • External images Changed

    HTTPS images are fetched when reachable; blocked, private, or non-HTTPS images may be omitted.

  • Page breaks Changed

    Page breaks come from conversion options and our PDF renderer pagination, not CSS page-break rules.

  • Forms and embeds Lost

    Interactive controls, iframes, and embedded widgets are not preserved as interactive PDF content.

Sample conversions

Static documentation page

Input
Single HTML file with article headings, paragraphs, code blocks, a table, linked CSS, and three HTTPS screenshots.
Output
The PDF kept the article structure, table, code text, and reachable screenshots. The linked CSS theme was not reproduced, so spacing and colors changed.

Client-rendered report shell

Input
HTML export containing a root div, script tags that render charts, external CSS, and placeholder noscript text.
Output
The PDF contained the static noscript and source HTML text available before JavaScript. Charts did not appear because scripts never executed.

Invoice HTML

Input
Invoice HTML with semantic table rows, logo over HTTPS, CSS page-break hints, and a footer block.
Output
Rows and logo rendered into a readable PDF. CSS page-break hints were ignored, so the footer moved to the next page after our PDF renderer pagination.

A real HTML → PDF run

We converted our HTML sample (490 B) with Document engine → PDF renderer on 2026-09-11. It took 47 ms and produced a 15 KB PDF file, 32× larger than the input. The engine raised no warnings.

Input · sample.html · 490 B

Standalone document with 1 heading, 1 paragraph, 1 table, 0 links, 0 images

Headings
1
Paragraphs
1
Tables
1
Links
0
Images
0
Standalone document
yes

Output · sample.pdf · 15 KB

PDF 1.7, 1 page, selectable text (LibertinusSerif-Bold-Identity-H, LibertinusSerif-Bold, LibertinusSerif-Regular-Identity-H, LibertinusSerif-Regular), 0 image objects

Version
1.7
Pages
1
Fonts
LibertinusSerif-Bold-Identity-H, LibertinusSerif-Bold, LibertinusSerif-Regular-Identity-H, LibertinusSerif-Regular
Images
0
Text layer
yes

Options and when to change them

pageSize
Set Letter or A4 when the PDF is meant for printing or invoice submission.
margins
Use when the semantic HTML needs explicit print margins because CSS margins will not drive layout.
toc
Use when h1 through h6 headings should produce a table of contents.

Do it yourself

pandoc + Typst

bash
pandoc in.html --pdf-engine=typst -o out.pdf

This is not a browser print; scripts do not run and stylesheets are not faithfully applied.

pandoc + Typst with page options

bash
pandoc in.html --pdf-engine=typst --toc -V papersize=a4 -o out.pdf

Use pandoc and Typst variables for page setup rather than CSS print rules.

HTML to PDF by API or MCP

The HTTP API and the MCP server run the exact engine this page uses (Document engine → PDF renderer); the response carries the same warnings the web converter shows. Check support first with GET /api/v1/pairs?from=html&to=pdf.

curl
curl -X POST https://filetypeconverters.com/api/v1/convert \
  -H "Authorization: Bearer $FTC_API_KEY" \
  -F "file=@input.html" -F "from=html" -F "to=pdf" \
  --output output.pdf
API reference

When this is the wrong conversion

  • If the page depends on JavaScript-rendered charts, use a browser print or headless Chromium workflow.
  • If pixel-perfect CSS is required, this semantic our document engine route is the wrong renderer.
  • If the input is Markdown, convert Markdown to PDF directly instead of wrapping it in HTML first.

HTML to PDF questions

Does JavaScript run before the PDF is made?

No. The converter reads the supplied HTML; scripts never execute.

Will my CSS stylesheet be preserved?

Mostly no. Our document engine render semantic HTML and only a small subset of styling has an effect.

Can external images appear in the PDF?

HTTPS images can be fetched when public and reachable. Private, blocked, or non-HTTPS images may be omitted.

How do I control page breaks?

Use conversion page options and review the result. CSS page-break rules are not the source of truth in this route.