1

I work for a retail store in a small town. We have charge accounts for workers and truckers to come by, get what they want, sign the papers and then get back to work. That's not really a problem, but my boss wanted to have signature pads set up at the counters so that they only had to sign once instead of signing 4-6 times per trip. I thought and read on it and I figured it wouldn't be too hard, so I talked my boss into letting me try getting one running. I've had experience with C# and AutoHotKey in the past, but hardly any network experience.

I've got most of my program running right now, but it's really sparse and not very efficient because I am using a pretty unreliable way of getting the signatures. I have a computer running linux in the office that is connected to a switch. On the same switch, I have an old printer that the switch is mirroring packets and sending them to the linux computer. Tcpflow on linux, which is set to startup and run automatically, 24/7, captures those packets and saves them in a shared folder on the network. The saved packet files can be easily converted with ghostscript from Postscript to PDF format to be signed.

The biggest problem I have is that mirroring this printer is really unreliable. If the printer happens to run out of paper in the office while nobody is back there, it piles print jobs up and no longer accepts TCP packets, so somehow the switch can't mirror them and it breaks the entire process.

Sometimes the network share from linux to windows gets unmounted in linux, but that's not really what I'm looking for in this question.

What I want to know is if there is some way of simulating a printer over the network, complete with a physical IP address, that I could print to with our store server. I can't just share a virtual printer or anything because our store server is running some proprietary software on SunOS. The only way to set up a printer on this software is by using the IP address of the printer.

If any further information is required, I will be more than happy to answer, I'll be available all day so it shouldn't take too long to reply if unless something comes up. Thank you all.

1 Answers1

1

Set up Samba on the Linux box, set up a shared "printer" that calls a script to save as PDF plus do whatever and even eventually print a hard copy.

The Samba config snippet might look like

[PDFprinter]
        comment = Samba Virtual PDF Printer
        printing = LPRNG
        path = /var/spool/samba
        printable = Yes
        lpq command =
        lprm command =
        print command = /usr/local/bin/print2pdf /var/spool/samba/%s /home/%U

And a simple PDF printer that puts the output in the user's $HOME - you can change this to do all sorts of stuff, and you can use any scripting language that can take input/arguments from stdin - %s is the print stream of PS data, %U is the user that printed to the share.

#!/bin/bash

bn=`date +%s`
ps2pdf "$1" "$2"/print_$bn.pdf

exit 0

Install the printer using any PostScript printer driver - I like the HP color laserjet drivers, pick an old enough model and the driver will be built into any OS you use it from (I specifically use the Color LaserJet 5/5m or 2500 series, the Apple Color LaserWriter was good back in the XP days...)

I've used similar set up printing to a PHP script that would store the PDF in a db as a blob, send an email to the user with a link to a webform to collect cover sheet info, send and receive faxes via hylafax and store incoming faxes in a DB. Running on a Pentium 200 w 32mb ram, sent and received 75k faxes per year for a 30 person insurance agency.

If an IP & Share Name won't work and you simply need a pure IP, then install CUPS on the Linux box and install its own shared printer, then re-share that out via CUPS - I think that will allow you to do a simple IP and perhaps port number to specify the printer to use.

ivanivan
  • 1,448
  • 6
  • 6
  • So does CUPS have its own shared virtual printer that I need to reshare again to the network somehow? I will have to try this because the only way I can print from the store server software is with a pure IP address. Not even a port is usable, it uses 9100 at all times. – Blake Cogburn Mar 25 '19 at 14:44
  • @BlakeCogburn - think CUPs has a fake PDF printer, but nothing as flexible as what you can code up in your own handling script. – ivanivan Mar 25 '19 at 14:57