wkhtmltopdf is unmaintained — what to use instead
wkhtmltopdf was archived by its maintainers and ships a WebKit build from another era. Here is what breaks, and how to move to a current renderer without rewriting your templates.
The project was archived, and the engine underneath it is a fork of WebKit that predates flexbox and grid as most people use them today. That is the root of the familiar symptoms: a layout that renders correctly in a browser and collapses in the PDF, web fonts that silently fall back, and CSS features that are simply ignored rather than approximated.
There is also the operational cost. wkhtmltopdf is a binary you install on every machine that renders, with system libraries it expects to find, and an unpatched rendering engine sitting in your infrastructure.
The migration is usually mechanical, because the input is the same HTML you already produce. Instead of shelling out to a binary, you POST the markup and receive the PDF. Page size, margins and orientation map onto the same options you were passing on the command line.
Command-line flags, translated
| wkhtmltopdf | PDFGeny |
|---|---|
| wkhtmltopdf in.html out.pdf | POST /api/v1/render with {"html": "..."} |
| --page-size A4 | "format": "A4" |
| --orientation Landscape | "landscape": true |
| --margin-top 10mm (and the other three) | "margin": "10mm" |
| --print-media-type | always on — rendering emulates print media |
| --zoom 0.8 | "scale": 0.8 |
Questions
Is wkhtmltopdf dead?
The repository is archived and no longer maintained. It still runs, but it will not gain fixes, and its rendering engine is years behind current browsers.
Will my existing templates work?
Usually yes, and often better — a current engine supports the CSS that the old WebKit ignored.
What replaces the command-line flags?
Page size, orientation, margins and zoom map onto JSON fields in a single request. The table above lists the equivalents.
Try it without signing up: convert HTML to PDF, or read the API docs.