Reputation: 3
I'll start of by pointing out I can code in python, c/c++, c#, ruby, and js. So if I need to code something it's not an issue. I just need help getting pointed in the right direction.
I want to know if there is a way to create a virtual printer either on windows or linux. Where I work there is a software that will create reports and generate the report on a remote computer from a vendor. The vendor then using IP sends the print job to the local printer of a user. I want to be able to create a virtual printer that instead saves the print job to pdf somewhere on the network for our users to fetch and print if needed.
Upvotes: 0
Views: 3549
Reputation: 605
If they send the print job to a network printer then a computer would need to take the place of the IP address used by the printer. I have ghostscript with socat set up to listen on port 9100 for a postscript file. This can then convert to a pdf and save the file. This generates a file name based on the time because there is no file name sent to port 9100. This should produce a directory full of pdf files sorted by the time. I haven't tried this on port 515 so that depends on how they send across the network because the 515 port has an LPD protocol and 9100 is just a raw socket.
#!/bin/sh
socat TCP4-LISTEN:9100,reuseaddr,bind=localhost SYSTEM:'gs -dQUIET -dNOPROMPT -dBATCH -sDEVICE=pdfwrite -sOutputFile=/tmp/\"$(date -Is)\".pdf -'
Edit: I just use this on my local machine or for testing so delete bind=localhost to listen on a network IP address
Upvotes: 1