Can I use Apple cups as a programmable printer API?
My intent is to have a "fake printer" (Appple cups) show up on the user's desktop/Chrome browser (print settings) after it's added through a server ip/port. And it's not going to deal with any printers... I want to extract the documents that would be printed and then treat them as files to then be shared with other computers (by regular file upload/download).
I know it sounds backwards but the printer as a starting point is key in this particular application.
This "fake printer" has to be added by Printers & scanners say through TCP/IP/port
It is very easy to create a print queue that saves files. There is the well-known CUPS-PDF software which does exactly that. So if you want to share that printer across a network, other users can 'send' files via the printer.
The print queue calls a CUPS 'backend' (which you have to write yourself, but it can be a shell script, or python, or any executable), and the backend deals with the incoming data.
I've written backends here (one for PostScript files, one for PDF) as shell scripts, and also one as python to further manipulate the PDF.
However, you could also achieve this using Folder Actions on a shared folder - e.g. network users drop their files on a shared folder, and AppleScripts are triggered to do something with the file. There's probably a whole host of better methods that don't involve CUPS.