That is, we need to come up with some settings in parameter no. However, piping the output of xhtmltopdf into cgpdftopdf is only interesting if we try to apply some "print options". | /usr/libexec/cups/filter/cgpdftopdf 1 2 3 4 "" \ So this should work: /usr/libexec/cups/filter/xhtmltopdf 1 2 3 4 5 my.html \ This additional filter expects the same sort of parameter number and orders, like all CUPS filters. While we are at it, we could try to apply some other CUPS print subsystem filters on the output: /usr/libexec/cups/filter/cgpdftopdf looks like one that could be interesting. Or, alternatively (this is faster to type and easier to check for completeness, using 5 dummy parameters instead of 5 empty ones): /usr/libexec/cups/filter/xhtmltopdf 1 2 3 4 5 my.html > my.pdf So, let's try it: /usr/libexec/cups/filter/xhtmltopdf "" "" "" "" "" my.html > my.pdf We also have to redirect the output to a PDF file. When we run it on the command line, we have to supply 5 dummy or empty parameters first, before we can put the input file's name. The only CLI params which are interesting to us are number 5 (the "options") and the (optional) number 6 (the input file name). If only 5 parameters are given, it reads its input from, otherwise from the 6ths parameter, a file name. The command requires in total at least 5, or an optional 6th parameter. Most of these parameter names show that the tool clearly related to printing. Usage: xhtmltopdf job-id user title copies options Calling it with no parameters at all (or with the wrong number of parameters) it will emit a small usage hint: $ /usr/libexec/cups/filter/xhtmltopdf The second thing to know is that it requires a specific syntax and order of parameters to run, otherwise it won't. It is in /usr/libexec/cups/filter/xhtmltopdf. The first thing to know is that it is not in any desktop user's $PATH.However, if you know about it, know where to find it and know how to run it, there is no problem with doing so: This filter is usually not meant to be used by end-users but only by the CUPS printing system. This method (ab)uses a filter from the Mac's print subsystem, called xhtmltopdf. It does not use LibreOffice at all and should work on all Macs. Ok, here is an alternative way to do convert (X)HTML to PDF on a Mac command line. I'm trying to convert a HTML file to a PDF by using the Mac terminal.
0 Comments
Leave a Reply. |