Wkhtmltopdf is EOL (archived 2023): official Frappe plan and recommended migration?

Hi Frappe team and community,

As per the security compliance wkhtmltopdf (wkhtmltox) as an end-of-life package: “wkhtmltox is EOL (2023) and cannot be upgraded.” Please advise on the officially supported alternative for HTML-to-PDF generation in Frappe.

What we found

  • The wkhtmltopdf upstream repository was archived on Jan 2, 2023. The last release is 0.12.6 (2020), and the newest packaging build is 0.12.6.1-3.
  • Frappe v15 and v16 both still support wkhtmltopdf (via pdfkit), and the Frappe Docker image pins 0.12.6.1-3.
  • In the v16 source we see a “PDF Generator” option on Print Format (wkhtmltopdf / chrome / Typst / WeasyPrint) and a ChromePDFGenerator in frappe/utils/pdf_generator.
  • We also saw a Frappe PR titled “refactor!: remove wkhtmltopdf and render every pdf with chrome”, but we could not confirm its status or target release.

Our environment

  • Ubuntu 24.04.3 LTS (noble), x86_64 / amd64
  • wkhtmltopdf 0.12.6.1 (with patched qt)
  • Frappe / ERPNext version: <Both v15 & v16>
  • Bench installed manually on an on-premises server

Questions

  1. Is there an official Frappe statement or documentation about wkhtmltopdf being EOL, and the recommended replacement?
  2. Is the Chrome PDF Generator in v16/15 considered production-ready as a full replacement? Are there known gaps (headers/footers, @page margins, custom print formats)?
  3. Is there a supported way to use Chrome (or another generator) on v15, or v16 required?
  4. Is there a migration guide for converting existing wkhtmltopdf-based Print Formats?

An official reference or roadmap would help us close the security finding.

Thanks & Regards,

Kanhu Charan Dash

Hi @kanhuc15656 and welcome to the community

The feature has been continously been in development since Oct last year ( feat: Chrome PDF generator by iamejaaz · Pull Request #34191 · frappe/frappe · GitHub )

Since then many improvements have been made (search for chromium on the github pr). Hopefully its enough for production - once it is backported from develop to v16 I assume thats a good enough signal from the maintainers.

Hope it helps

Hi @asieftejani ,

Thank you for the confirmation.

As per our understanding, in Frappe Version 16, the Chrome generator is installed by default, and the file extension can be changed through the UI.

However, we would like to understand how to use the Chrome generator in Frappe Version 15, as it does not appear to be available by default.

Could you please guide us on the steps required to configure and use the Chrome generator in Frappe Version 15 as well?

@kanhuc15656

I searched for “chromium” in the github releases page (chromium · Releases · frappe/frappe · GitHub) but only >16 showed up

So I dont think it has been backported to v15

Best of luck

Hi @kanhuc15656 . You can get the Chrome PDF generator in version 15 via the print_designer app. In version 16, the Chrome PDF generator has been merged into the frappe app, so the print_designer app is no longer needed for that feature.

There is a lot of work going on right now in version 16 making sure everything is ready for the Chrome generator (like @asieftejani said, check the PRs) and wkhtmltopdf has been officially deprecated- it will not be used any more in version 17 when that is released.

I went through this EOL of whtmltopdf problem elsewhere. After a lot of research, I discovered that the best option is “weasyprint” (already packaged for Ubuntu). Weasyprint is not a headless web-browser, but a dedicated HTML/CSS (no JS) program, which is great for making reports, and it’s also a lot faster, and avoids many of the headaches with JS/security. It also lets you reliably control page size/orientation.

Again, just to save others the pain, all the other headless browser-to-pdf tools like phantomjs, casparjs, slimerjs are defunct, and if you try to use chromium or firefox headlessly on Ubuntu, snap package confinement will stop you doing this as a daemon. If you want a browser-based solution because you actually need JS, I recommend installing the tarball of midori into /usr/local, and you’ll still go nuts with race-conditions unless you wrap the invocations in flock().

I hope that helps others.

Hello @kanhuc15656

  1. wkhtmltopdf is deprecated in v16 and removed in v17. From v17, every PDF is rendered with Chrome.
  2. The Chrome generator is production ready. It handles @page size and margins, header and footer from the letter head, and existing Jinja print formats. Chromium downloads itself the first time a PDF is made, so there is nothing to install.
  3. v16: set Print Settings > PDF Generator to Chrome. A format that has its own PDF Generator set uses that, so change it on those formats too. v15 has no Chrome generator in core.
  4. Most formats render the same. Check custom formats that use wkhtmltopdf only options or its header and footer variables, and look at page breaks.

We are making Chrome the default for new v16 sites, and making the Print Settings switch apply to every PDF, including report PDFs.