Error while generating PDF using pdfkit on macOS (M4)

Hi everyone,

I’m encountering an issue while trying to generate a PDF file in Frappe using pdfkit on macOS (M4 chip).

Here’s the traceback:

OSError: No wkhtmltopdf executable found: "b''"
If this file exists please check that this process can read it or you can pass path to it manually in method call, check README. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf

It seems wkhtmltopdf is missing or not properly linked.
However, when I try installing it with Homebrew, I get this error:

Error: Cask 'wkhtmltopdf' has been disabled because it is discontinued upstream! It was disabled on 2024-12-16.

So far, I’ve tried:

  • Installing via brew install wkhtmltopdf (fails due to deprecation)
  • Checking /opt/homebrew/bin/wkhtmltopdf (not found)
  • Reinstalling pdfkit

It seems wkhtmltopdf support for Apple Silicon / macOS M4 is broken or unavailable through Homebrew.

Has anyone found a working solution or alternative for PDF generation in Frappe on macOS M4 (Apple Silicon)?

1 Like

click on print instead of pdf

1 Like
OSError: [Errno 86] Bad CPU type in executable: '/usr/local/bin/wkhtmltopdf'

error

wkhtmltopdf is a major pain to work with. If you can avoid it, you probably should.

I’m not sure what the current status of this roll out is, but Frappe v16 (to be released in the future) and Print Designer (available now) both enable PDF generation via headless chrome. If it were me, I’d pursue one of those two options rather than trying to troubleshoot wkhtmltopdf.

If you do want to use wkhtmltopdf, it sounds like the issue is with homebrew/apple silicon support. Fixing that is way beyond the scope of what Frappe can do (especially when it’s moving to a new solution anyway).

2 Likes

true that

for now what can be done to generate pdf ?