cupsfilter not working on macOS Catalina 10.15

Hello,


I was using cupsfilter to convert html files to pdf on macOS 10.14 and earlier and it was working fine but after I upgraded to 10.15 the utility doesn't work anymore.


Does anybody know why isn't it included in the latest OS or if there is any alternative for cupsfilter on 10.15 for converting html files to pdf?


Thanks,

Martin

Replies

hi, any luck on this? Trying to do the same but getting errors.

I was using this, too, and I was disappointed to discover that it had been removed.


In macOS 10.14, cupsfilter invoked an XHTML/HTML to PDF filter program, /usr/libexec/cups/filter/xhtmltopdf, as listed in the MIME conversions file, /usr/share/cups/mime/apple.convs:

application/xhtml+xml           application/pdf                 33      xhtmltopdf
text/html                       application/pdf                 33      xhtmltopdf


macOS 10.15 has neither the xhtmltopdf program nor the entries above; I assume Apple meant to remove them, but I don’t know why.


As a workaround for private use, xhtmltopdf from the macOS 10.14 installation package does seem to be able to run on macOS 10.15.4. The file is very small (only 31 K), so clearly most of the work is done by the system frameworks with which it’s dynamically linked.


The xhtmltopdf filter isn’t part of the open-source CUPS package, but the filter(7) manual page does give some hints on how to invoke it. For example, at the most basic, you can run:

./xhtmltopdf 1 "" "" 1 "" input.html > output.pdf


To suppress the “ERROR: Unable to open PPD file” message, set the PPD environment variable to point to a generic one:

PPD=/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Resources/Generic.ppd \
./xhtmltopdf 1 "" "" 1 "" input.html > output.pdf


You can also specify options, as with the -o flag to cupsfilter; for example, to change the page size to A4:

PPD=/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Resources/Generic.ppd \
./xhtmltopdf 1 "" "" 1 "media=A4" input.html > output.pdf
Post not yet marked as solved Up vote reply of w17 Down vote reply of w17