Simple (postscript) printer setup in OpenBSD 4.3

Printing in UNIX may sometimes be somewhat of a hurdle. This is also very dependent on which type of setup you want (local or remote and which software to use) and which type of printer you have.

In general you need; a properly configured printer driver towards the printer (assumes a local printer) and a spooler which handles queue management of print jobs. In addition you may use print filters which are able to convert input to a suitable format understandable by the printer.

Printer setup is not much different in OpenBSD compared to any other UNIX system (e.g. FreeBSD). Most programs needed are available in packages collection. I would highly recommend Dru Lavigne UNIX Pringting Overview for a good start for UNIX printing.

I explain the simple setup I needed to do for my USB connected printer, HP LaserJet 1320.

First you need to identify a suitable driver for you printer. I checked linuxprinting.org for my printer and the printer manual. Here I found out that my printer has (emulates) postscript but for full capabilites I need HPLIP driver. The hplip-2.7.10 driver is available in the packages. But as this requires quite a lot of extra effort (see install message) I just stick the emulated postscript support which is the easiest setup.

My printer is connected to USB which is automatically identified at boot. A virtual printer device is setup on /dev/ulpt0 which can be seen in dmesg output.

# dmesg
...
ulpt0 at uhub1 port 2 configuration 1 interface 0 "Hewlett-Packard hp LaserJet 1320 series" rev 1.10/1.00 addr 3
ulpt0: using bi-directional mode
...

You may want to try to send something directly to the printer device. lptest just print a character stream.

# lptest 70 5 > /dev/ulpt0

Something should show up on the printer. I only does this after printing a test page (directly on the printer) afterwards.

Next step is to setup the spooler. This is done using apsfilter which is the simplest setup. Install apsfilter from packages and run the setup utility (logged in as root).

# pkg_add apsfilter-7.2.8p0
# /etc/apsfilter/basedir/SETUP

Just follow the instructions during the configuration. Because my printer support postscript this setup is really simple. In the main menu you are also able to print a test page which is very useful to see that everything is working. See Printing for the Impatient for more information about this.

After this you should have a working configuration stored in /etc/printcap. The last step is to start the spooler deamon lpd. Start it from command line by issuing lpd and add it to /etc/rc.conf.local to start it at boot time.

lpd_flags=""		# for normal use: ""

Now everything should be setup with printing support. Try printing a page from e.g. firefox.