wkhtmltopdf alternative

A maintained wkhtmltopdf alternative

wkhtmltopdf's repository was archived in 2023, and it renders with an old QtWebKit. Forme takes the same HTML and print CSS, ships as WASM instead of a native binary, and is released and tested continuously.

Replacing the wkhtmltopdf CLI
# before
wkhtmltopdf --header-html header.html invoice.html invoice.pdf

# after — headers live in your CSS as @page margin boxes
npx @formepdf/html invoice.html -o invoice.pdf

No binary to install — WASM runs on Node, Python, Workers, and the browser.

@page margin boxes replace --header-html and --footer-html.

Released continuously, with CI-gated output.

Side by side

Headers, footers, and page numbers

wkhtmltopdf puts running headers in separate HTML files passed as flags. Forme uses the CSS standard for it.

Running header and page numbers

Before · wkhtmltopdf
wkhtmltopdf \
  --header-html header.html \
  --footer-center "[page] / [topage]" \
  --margin-top 25mm \
  invoice.html invoice.pdf
After · Forme
@page {
  margin: 72pt 54pt;
  @top-center { content: "ACME WIDGET CO."; }
  @bottom-center { content: counter(page); }
}
@page :first { @top-center { content: none; } }

Why move

What you get by leaving wkhtmltopdf

Maintained and tested

Every commit runs the engine against a fixed corpus, with byte-identical output enforced across builds.

No native binary

No system package, no patched-Qt build, no fonts to install on the host. It runs from npm or PyPI.

Modern layout

Flexbox, CSS Grid, and floats in the HTML path, with tables whose headers repeat on every page.

Errors you can see

Unsupported CSS is reported by name in the warnings instead of rendering wrongly in silence.

PDF/A and PDF/UA

Archival and accessible output, verified with veraPDF — not something wkhtmltopdf produces.

Python, too

pip install formepdf[local] renders HTML in-process with one dependency, if wkhtmltopdf came to you through a Python wrapper.

wkhtmltopdf migration questions

Is wkhtmltopdf still maintained?
No. Its GitHub repository was archived in 2023, and it renders with an old QtWebKit engine, so modern CSS such as flexbox and grid is unreliable.
How do I replace --header-html and --footer-html?
Use CSS @page margin boxes. Put the header in @top-center and the page number in @bottom-center with counter(page). @page :first can suppress the header on the title page.
Do I need to install anything on the server?
No system packages. Forme is WASM: install @formepdf/html from npm, or formepdf from PyPI, and it runs in-process.