Alternatives · Puppeteer
From wkhtmltopdf to Puppeteer: what changes
Puppeteer, the Node.js library that drives Chrome (Apache-2.0), prints with page.pdf(); wkhtmltopdf’s status page suggests it for pages with dynamic JavaScript. pdfkiln prints with the same Chromium, but answers to wkhtmltopdf’s command line.
What changes when you leave wkhtmltopdf for Puppeteer
- Code instead of a command line. A Node.js program launches the browser, opens the page and calls
page.pdf(). The libraries that call wkhtmltopdf, knp-snappy, pdfkit, wicked_pdf and the others, do not call Puppeteer. - Options. wkhtmltopdf’s options become Puppeteer’s PDF options (
format,margin,scale,printBackground,pageRanges…) or code; the cover page and the table of contents have no equivalent. - Headers and footers. Puppeteer’s are HTML templates filled through five classes (
date,title,url,pageNumber,totalPages). wkhtmltopdf’s--header-htmland--footer-htmlare full pages, withpage,topage,sectionand others in their address, and their JavaScript: templates built on them, Odoo’s and Frappe’s among others, are to be rewritten. - Layout. Chrome lays out the page as a browser does, without wkhtmltopdf’s quirks (the 0.8 shrinking,
@pageignored,flexandgridignored…): templates tuned for wkhtmltopdf can change page breaks and page count. - The browser. Installing Puppeteer downloads Chrome for Testing, about 282 MB on Linux, and
chrome-headless-shell. - Internal addresses. The page loads what it asks for; keeping it away from internal addresses, the problem of CVE-2022-35583, is up to your code, through request interception.
When Puppeteer is the right choice
New Node.js code, or more than PDFs: screenshots, tests, scraping, a page that needs a login or a click before it prints.
When pdfkiln is
Code or libraries that call wkhtmltopdf today, templates whose page count must not change, another language than JavaScript, no browser automation to write: pdfkiln takes wkhtmltopdf’s place, Chromium underneath, with the emulations that keep its pages. Called as pdfkiln, it gives Chrome’s current CSS without them.
Sources
Puppeteer’s PDF options, its installation, its license on GitHub, and wkhtmltopdf’s status page, read on 29 October 2026.