1

Printer drivers, backends and PPDs are all now deprecated in CUPS, so I'm looking for the 'new' way to print PDF files to disk. Michael Sweet (the inventor of CUPS) suggests that ippeveprinter is the way forward, but I'm having difficulty understanding it.

I set it up with ippeveprinter -D /Users/Shared/Print/ "Qwe", and I get "Listening on port 8501" in reply.

So I send a file with:

lp -d Qwe /path/to/file

and the ippeveprinter process splurges out a load of 'success' messages:

localhost POST /ipp/print
localhost Continue
localhost Get-Job-Attributes successful-ok
localhost OK
localhost POST /ipp/print
localhost Continue
localhost Get-Printer-Attributes successful-ok
localhost OK
localhost Client closed connection.

But no file is to be found at the chosen location. Or anywhere else that I can see.

Any ideas? This is on macOS, but CUPS covers other OSes, too.

benwiggy
  • 1,440
  • 17
  • 35

3 Answers3

2

For ippeveprinter, -D specifies the output directory. Use the -d to save a copy of the spool file and the -c to product Postscript.

I tested it this way:

% ippeveprinter -k -D file:///Users/Shared/print -c /usr/libexec/cups/command/ippeveps "Qwe"
Listening on port 8501.

The file is saved as Postscript (.prn), so you will need to convert them to your format of choice. Homebrew has ps2pdf, which I tested does properly make .pdf files from the .prn file.

James Risner
  • 5,451
  • 11
  • 25
  • 47
  • 1
    Yes, that does work, thanks; though URF is a useless format, and not easily converted. – benwiggy Aug 24 '22 at 21:11
  • I've written out my tests as a new answer. We're nearly there, but not quite! Thanks for you help, which has pointed me in the right direction. – benwiggy Aug 25 '22 at 09:55
  • 1
    Sadly, it produces a rasterized PS file. I'm beginning to thing that ippeveprinter just isn't up to the functionality required. – benwiggy Aug 25 '22 at 16:06
1

The man pages say that the -D option will create an output file using the job ID and name, when the URI is a directory.

Using -d (lowercase) with -k (as in James Risner's answer) simply moves the location of the temp spool folder.

To output a file, it seems you have to use -c ippeveps (though my setup needed the full pathname of /usr/libexec/cups/command/ippeveps).

This produces a PostScript file (though with the file extension .prn). Even using the -F application/pdf option did not produce a PDF file. Again, the man page says it must be used with the -P option that specifies a PPD file. This also didn't work, unless I added a line to the PPD that specified PDFs to be generated:

*cupsFilter: "application/pdf 0 cgpdftopdf"

However, this references a CUPS filter, and the whole point of this exercise is to avoid using filters and PPDs, because they're deprecated.

(The PPD file was a Generic file generated by CUPS; you'll need to create or point to your own.)

So, the following command works for now:

ippeveprinter -D file:///Users/Shared/Print/ -c /usr/libexec/cups/command/ippeveps -F application/pdf  -P /private/etc/cups/ppd/Direct_PDF.ppd Qwe

... with the caveat that it won't help when filters and PPDs are no longer supported.

benwiggy
  • 1,440
  • 17
  • 35
  • @JamesRisner No: as said I generated the PPD from CUPS. I could try other PPD files. The man pages explicitly say that -D is required to set an output location (and that's identical to how CUPS does it for backends. Your trick of changing the spool folder produces two files: the PS file and the URF. Both methods work, in that they put PS files in a folder, but (given the limited documentation) neither is optimal, compared to the deprecated functionality. – benwiggy Aug 25 '22 at 16:03
  • 1
    @JamesRisner Michael Sweet has confirmed that ippeveps won't generate PDF (even though I managed to do so somehow); so it looks like this is a dead horse. But all info is useful! Thanks. – benwiggy Aug 25 '22 at 16:55
  • 1
    I've read the source of `ippeveprinter`, it takes the argument passed to `-F` and copies it into an environment variable `OUTPUT_TYPE`. There's no code in `ippeveps` that does anything with `OUTPUT_TYPE`; it converts everything into PostScript (read ippeveps.c and ippeveprinter.c yourself to check: https://github.com/OpenPrinting/cups/tree/a8eaa67dd10dbaa7856b436ad921ad748f7de0bb/tools). In short, there's no way to get a pdf out of these tools unless you chain on things like the PPD hack or write your own script using other utilities and pass it to `ippeveprinter` with its `-c` flag. – 3353755 Jun 28 '23 at 01:16
0

I hope to clear up a misconception or two in this answer.

  • ippeveprinter is a fully functional IPP printer. In IPP everywhere terms it performs in the same way as my ENVY4500. That is, it will advertise itself via mdns on the network and print jobs for any page description language (pdl) it is capable of. The difference is that ippeveprinter prints to a spool directory whereas the ENVY4500 prints on paper.
  • HP determine what are acceptable pdls in its printer's firmware. ippeveprinter does the same with its -f option: ippeveprinter -f application/pdf myprinter. It is important to realise that, when a CUPS client interacts with myprinter, it is obliged to send a PDF.
  • It is even more important to appreciate that once that PDF appears in ippeveprinter's spool directory then CUPS has done its job. That's it, CUPS is now out of the picture. It hasn't any say in what ippeveprinter does next.
  • Unlike my ENVT4500, ippeveprinter can run a command for every job that is printed to its spool directory. The command could involve using a PPD and a vendor driver. CUPS couldn't care less; it is not involved. This is the basis of a Printer Application.
  • On Debian (using the previous ippeveprinter command) the PDFs appear in /tmp/ippeveprinter.xxxx. I could transfer them elsewhere with the -D option. I could also manipulate them with -c.
  • SUMMARY: ippeveprinter is an everywhere printer. The user determines how CUPS interacts with it and how it consequently behaves.
brian_p
  • 11
  • 2
  • So, does that mean that I can't use it to create a PDF-to-disk queue? – benwiggy Jun 08 '23 at 20:23
  • I print PDF files to disk from Firefox using myprinter, which is Set up with `/usr/sbin/ippeveprinter -k -d $HOME/Downloads/ -f application/pdf myprinter`. – brian_p Jun 09 '23 at 11:57
  • Yes! Apart from ippeveprinter being in bin, not sbin, this works beautifully! The man pages seem to have the -F and -f flags swapped. I still have to create a print queue that uses the 'printer', and that requires a deprecated PPD, but that may just be macOS. If you post it as an answer, I'll accept it! Ideally, I'd need to get this running in the background, and not in a Terminal window. – benwiggy Jun 12 '23 at 09:59