I would like to add a 'virtual' printer to easily send PDF output from any software. The printer should be a script which then processes the PDF output. Use-case could be "print to cloud storage" or "print to archive" etc.
The possiblities I discovered so far are:
- CUPS pipe backend (described here) which seems to be not available on Ubuntu.
- tea4cups (from this thread) which forwards the file to
lp
after pre-processing it. But I do not want to actually print it.
Is there another simpler way to just get the PDF piped into a custom bash script?
The clues appear to be in the first link in your question. Research indicates that backends are just scripts. So you could simply write your own. However it appears that the script you are looking for that's available for OpenSuse is described in your first link.
finding this script is complicated by the fact the OpenSuse now uses .ymp one click installers and you have to dig a bit deeper to find the actual .rpm that contains the script. Here's an example taken directly from cups-backends-1.1-296.6.noarch.rpm available here.
Opening the package with file roller and navigating to
/./usr/lib/cups/backend/
within the package and openingpipe
reveals the script below:Since this is a bash script you should be able to use it with any version of 'nix including Ubuntu, with a bash shell, not just Suse.
In order to add a backend to cups you'll need to copy it to
/usr/lib/cups/backend
and set the permissions and ownership to match.chown root:root /usr/lib/cups/backend/pipe
chmod 755 /usr/lib/cups/backend/pipe
Sources:
https://www.cups.org/doc/man-backend.html
https://build.opensuse.org/package/view_file/Printing/cups-backends/cups-backends.spec?expand=1
How do I extract a RPM file?
I was looking for the same thing, but found nothing easy. I'll write here how i solved it , maybe others will find the solution useful.
My driver is for manual duplex printing, but instead of duplex printing(in the duplex-print file), you can implement your own code. You also have an installer in there ...
source code is on github: https://github.com/dentys03/manual_duplex_linux
It should work on any HP printer. Easily adapted for other printers, i guess.