Using a program called p910nd you can take any non-network printer and turn it into a network printer over Ethernet or Wifi.
- A printer
- Raspberry Pi
Grab a copy of FreeBSD for your Raspberry Pi and install it on to an SD card. Really it doesn't have to be a Raspberry Pi, instead you can use any SBC that FreeBSD runs on. Bannana Pi, Pine A64, Orange Pi, etc... The idea is to use a low cost/power device that needs little maintenance and has no moving parts.
There are several guides on how to install FreeBSD on a Raspberry Pi, so I won't cover that here. But the basic idea is download the pre-build image from FreeBSD's FTP servers for your hardware. For example, to use FreeBSD 12.1 for a Raspberry Pi 1 Model B, you would download the image from ftp://ftp.freebsd.org/pub/FreeBSD/releases/arm/armv6/ISO-IMAGES/12.1/FreeBSD-12.1-RELEASE-arm-armv6-RPI-B.img.xz. You then take that image and use something like Etcher to transfer it to your SD card.
After booting FreeBSD for the first time, log in as root user with the default password 'root'. The use the passwd command to change your password. If you are remotely logging in, you'll need to use freebsd/freebsd instead, then su to root.
There is only one package needed and that is print/p910nd. Install it using pkg.
pkg install -y p910nd
Type in 'Y" and press enter if you are prompted with the following:
The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]:
After pkg is bootstrapped, the required package will be installed.
Setup the Service
Enable the service using the sysrc command. This will launch the daemon at startup.
You may or may not have to pass along some additional flags to specify your printer device file (-f) as per https://www.freebsd.org/doc/handbook/printing-connections.html. Additionally, by default the daemon will listen on IPV6 interfaces only. Pass the '-i' flag to force it to use IPV4.
If your printer supports bi-directional communication (you'll see this in your system log as 'ulpt0: using bi-directional mode'), pass the '-b' flag as well. Note: if you run into problems such as an infinite print job, disable bidirectional printing.
sysrc p910nd_flags="-f /dev/unlpt0 -i 0.0.0.0 -b"
Start the service
service p910nd start
Add the Printer on your Client
Now you should be able to add the printer using your OS's print client and spooling service. For example, in Windows you would add a new printer from the control panel using a Standard TCP/IP port.