]> Simple printer filter for PJL/PS/PCL capable network printers under LPRng

Simple printer filter for PJL/PS/PCL capable network printers under LPRng

by Stephan K.H. Seidl

Version 2, Sat, 03 Jun 2017 20:17:41 +0200

HP LaserJet 4M Plus PS 600   HP LaserJet Pro M201dw
HP LaserJet 4M Plus PS 600   HP LaserJet Pro M201dw

Introduction

It had a JetDirect and a PostScript interpreter card, was fully equipped with memory, and it was quite expensive at the time. Every operating system knew it. It did not print duplex and, at the end of its life, also not particularly beautiful. In addition, it occasionally jammed also. Its PostScript interpreter was so slow that it was better to convert PostScript into PCL, using a filter on the printer server, and feed the device with the latter format instead of PostScript. On the other hand, it printed and printed and printed. Yes, so was it, the HP LaserJet 4M Plus PS 600. It faithfully served more than two decades and then, in 2015, it got suddenly broken, somewhere in the electronics, while turning it on. As a replacement, a comparably reliable black-and-white laser network printer was sought for not too high a print volume, of dimensions not larger than the LJ 4 one's, today of course for double-sided printing and with PostScript Level 3, but above all not too expensive. The HP LaserJet Pro M201dw is exactly such a substitute.

Printer setup

In contrast to the LJ 4, the LJ Pro M201dw has not gotten an Ethernet connector plugged in, but runs as a Wi-Fi client. This operating mode has the advantage that the printer, not being behind a UPS, is not able to forward the slightest overvoltage from mains to the communications infrastructure. This is not only good for the communications infrastructure, but also for the printer, since, in this way, the latter stands galvanically in only one network, that is the electric power distribution network. IPv4 has statically been configured here, IPv6 has been disabled. LPD Printing is the only service that must be enabled here. In the present case, 9100 Printing, Syslog and Telnet configuration have also been enabled. For the known reasons, Telnet should not be used but provides a solid access option if serious misconfigurations have occurred. Only the first 16 characters of the selected password are significant. So, to avoid misunderstandings, passwords should not be longer. Economically configured, but with Wi-Fi of course, the printer consumes something between 2 and 3 watts in standby mode. The value has been measured. With such a consumption, the printer need not be switched off. It wakes up very quickly, and the PostScript interpreter seems to be quite fast.

Print spooler, printer driver

In terms of the variety of supported protocols, the LJ Pro M201dw leaves nothing to be desired. Here, however, we only need LPD, and if anything else, then at most JetDirect, that is 9100 Printing. On UNIX-like boxes, LPRng is preferred here as the print spooler, together with a simple handmade filter. LPRng maintains the operating system svelte and clear. If one wants to know something about the printer or wants to manage it, one advantageously communicates with its Web server, for example via HTTPS. The simple filter for LPRng allows to easily make adjustments and to directly print PDF, PostScript and US-ASCII files. UTF-8 encoded files from the Western European area are also mastered, meant are files that contain only characters from the ISO-8859-1 character set and are UTF-8 encoded. On Windows boxes, the way is as follows. Should be printed one-sided, which almost never happens, it can directly be printed onto the LJ Pro M201dw with the HP LaserJet 4/4M Plus PS 600 printer driver. This printer driver always addresses the TCP port 9100 of the printer. The habit is two-sided printing. For two-sided printing, the HP LaserJet 4/4M Plus PS 600 printer driver is also used, but it is not printed onto the printer itself but onto some server. That server accepts the print job on port 9100, spools it in, deactivates all those instructions in the data stream that intend to suppress two-sided printing, and then sends the job to the LPD port of another server or even the LJ Pro M201dw. In other words, the mentioned server implements a JetDirect interface to get access to printer jobs from Windows to rectify the situation for two-sided printing. A similar game can also be played using Samba. This is the whole secret.

What runs where

On all UNIX-like boxes, an LPRng runs with the same configuration. Relevant files are lpd.conf, lpd.perms, printcap, simpleprinterfilter1, simpleprinterfilter2, and simpleprinterfilterdebug. Surely at least the file lpd.perms has to be adapted. The hostname pserver belongs to the printer server, the only UNIX-like box that forwards print jobs to the printer, referred to as pserver1. In our environment, the names pserver and sbase represent different IP addresses, but are both assigned to the same interface of a particular server. This server is also the one that listens at port 9100 to support printing from Windows via the JetDirect interface. The appropriate configuration files are services and xinetd.conf. Both files show only the JetDirect relevant entries. Here is once more the list of the files as they are involved. In this context it should finally be noted that, from Firefox, printing without CUPS is typically not possible by default. So the file gtkrc shows a configuration option to make Firefox system-wide ready to print via LPR, i.e., to print via LPRng in our case.


-rw-r--r-- ... root root ... /etc/lprng/lpd.conf                     (click here for download)
-rw-r--r-- ... root root ... /etc/lprng/lpd.perms                    (click here for download)
-rw-r--r-- ... root root ... /etc/printcap                           (click here for download)
-rw-r--r-- ... root root ... /etc/services                           (click here for download)
-rw-r--r-- ... root root ... /etc/xinetd.conf                        (click here for download)
-rwxr-xr-x ... root root ... /usr/bin/simpleprinterfilter1           (click here for download)
-rwxr-xr-x ... root root ... /usr/bin/simpleprinterfilter2           (click here for download)
-rwxr-xr-x ... root root ... /usr/bin/simpleprinterfilterdebug       (click here for download)
-rw-r--r-- ... root root ... /usr/share/themes/Raleigh/gtk-2.0/gtkrc (click here for download)

Conclusion

A dead HP LaserJet 4M Plus PS 600 can directly be replaced by an HP LaserJet Pro M201dw without having to make any change to the software. If the operating software is sufficiently open and simple, then some small adjustments succeed, which allow to enable two-sided printing even using ancient printer drivers.


Sat, 03 Jun 2017 20:17:41 +0200

Stephan K.H. Seidl