1

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

Update

I will answer this after having done it 2 years ago. Yes it is possible. I wrote a NodeJS API wrapper (cli calls eg. lpstat...) and pretty much this meant we could generate these fake printers on the fly and when the user installed them on their computer via an https url, they would print files and they would be shareable to whatever web application.

We did have to hire a guy to modify the binary to do the multi-folder part since that wasn't working.

In the end this was not worth the effort/weird niche use case since we could just drag-drop to an S3 bucket/get signed url and there's your file.

6
  • 1
    Please elaborate and explain how PDF doesn't already do that? macOS uses DisplayPDF and that means everything is drawn on screen using PDF and anything you can print can also be saved as a PDF. On Windows you need the PDF printer but not on macOS. Commented Jun 18, 2021 at 19:28
  • I'm trying to make a fake network printer that will act as a file upload. The PDFs have editable fields (which is a concern). But the intent is to receive the files (on server) and treat as a buffer to then be able to send to other clients. I know it's backwards but it's a niche use case where they want to print not upload (interop problem). Printing eliminates a step/several in case of batch. -- also during this the users are connected to each other so there's no storage of files/it's just keeping it in memory and sending it. Commented Jun 18, 2021 at 19:29
  • See this - shareyourrepair.com/2012/07/… Commented Jun 18, 2021 at 19:37
  • But is that to your self, this is part of an application where the printed pdfs render on other people's screens (remote ips) in real time... anyway I am going to look at the IPP protocol first as it's http-based and if not I'll check out cups -- I apologize if I wasn't clear. By "regular file upload/download" above I meant the central remote server would deal with that after it received the printed documents. Commented Jun 18, 2021 at 19:39
  • Just sounds a lot like print to fax or PDF. Except you want to receive the print stream and process on a server queue and not just tiff/PDF. You are going to have to hardcode such a solution. Commented Jun 18, 2021 at 19:45

1 Answer 1

4

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.

6
  • Probably a dumb question but this is remote right? Not a Linux box in the same building. Yeah I think this is what I'm going to do... later realized IPP is inside of cups and yeah... IPP on its own looks like it's asking for an actual printer somewhere. I just want something that can be added as a printer in say Windows 10 printer scanner and then capture the sent files on the server. Anyway I will check the resources out that you have mentioned, trying to stay in JS but I can use Python too. Thanks Commented Jun 19, 2021 at 18:19
  • Macs can share their print queues over the network: I don't know whether PCs can access that. I don't know what you mean by "this" in "this is remote". I think you might get a better answer if you explain exactly what you want in more detail.
    – benwiggy
    Commented Jun 19, 2021 at 18:56
  • I'm setting up cups-pdf on a Ubuntu box/remote (in the cloud) so I think it'll work. I'm trying it out now. It's supposed to be a central hub that any pc can print to and then we use the received files on the server side. Commented Jun 19, 2021 at 19:06
  • It actually might not, might be a local network thing only and then use VPN to connect to that network... don't get why you couldn't just directly go from local to remote. Commented Jun 19, 2021 at 22:00
  • If you're asking about PCs connecting to shared printers on remote Linux boxes, then you might want to post on Stack Exchange.
    – benwiggy
    Commented Jun 20, 2021 at 8:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .