Migration guides · ERP
Replace wkhtmltopdf with pdfkiln in Frappe and ERPNext
Frappe, and ERPNext on top of it, print with the wkhtmltopdf found in the PATH. Its print formats put headers and footers in --header-html and --footer-html pages, filled by JavaScript.
1. Install pdfkiln
On Debian and Ubuntu (amd64 and arm64), from the signed APT repository, which brings Chromium’s security fixes with apt upgrade. It installs /usr/bin/wkhtmltopdf and replaces the official wkhtmltox package.
curl -fsS https://apt.pdfkiln.org/pdfkiln-archive-keyring.asc | sudo tee /usr/share/keyrings/pdfkiln-archive-keyring.asc > /dev/null
printf 'Types: deb\nURIs: https://apt.pdfkiln.org\nSuites: stable\nComponents: main\nSigned-By: /usr/share/keyrings/pdfkiln-archive-keyring.asc\n' \
| sudo tee /etc/apt/sources.list.d/pdfkiln.sources
sudo apt update && sudo apt install pdfkiln
Elsewhere: the Docker image, the archives and the Windows installer.
2. Point Frappe and ERPNext at it
Nothing to configure: Frappe finds the program in the PATH.
3. Check
wkhtmltopdf --version
# wkhtmltopdf 0.12.6 (with patched qt), pdfkiln <version>, Chromium <version>
The answer starts as wkhtmltopdf 0.12.6’s does: libraries that read the version keep working.
What Frappe and ERPNext expects, and what pdfkiln does
- Frappe looks for
qtin the answer ofwkhtmltopdf --versionto know whether HTML headers and footers work: pdfkiln keeps(with patched qt)in it for that reason. - The JavaScript and images of header and footer pages run even with
--disable-javascriptand--no-images, as in wkhtmltopdf, where those settings reach only the printed page: Frappe’s footer fills in “Page 1 of 2” by script. - Table rows that do not fit at the bottom of a page move whole to the next one, and
theadrepeats on every page, as with wkhtmltopdf.
Tested
The ERPNext 15 print formats of the 32-template corpus keep their page count against wkhtmltopdf 0.12.6 (Linux).
Something renders differently? Open an issue with the HTML and both PDFs: github.com/Jamalofski/pdfkiln/issues. The known differences are listed in the README.