Changing LaserJet defaults on a modern operating system

I have a LaserJet 2100tn which has done 59,553 pages. It's required minimal maintenance from me, so despite the fact that it has a date code of October 18th, 1999, I still use it. It's just as fast as modern small business/home use laser printers, and the toner cartridges are all mechanical (no DRM). It's also really easy to repair and maintain, should you break the tray 2 pickup like I did ☺.

Unfortunately, it has basically become impossible to change the print defaults on a modern operating system because the utilities were built for Windows 95/98 and only minimally updated for Windows 2000.

The MacOS utilities were built for MacOS 8, and if there are any OS X utilities, they were surely built for PowerPC Macs.

If you have a JetDirect card (like I do), there is a web UI, but it's built using late 90's Java and HTML, and you still can't change all of the print defaults. Some of those print defaults (density) can't even be configured in most applications, so whatever the printer has as the default is what the printer uses.

My toner cartridge is not genuine HP, has an aging photosensitive drum, and is running low on toner. It's always printed a lot lighter than it should, and I've just dealt with it. Well, today I found out that I can actually increase the toner density through some printer commands.

To change these defaults, you need to send a print job that:

  1. Puts the printer into PJL mode.
  2. Sends PJL commands to configure the defaults.
  3. Exits PJL mode.
  4. Optionally prints a test page so you can confirm your settings applied.

You can do this with a shell one-liner:

1
ruby -e 'print "\e%-12345X@PJL\r\n@PJL DEFAULT DENSITY=5\r\n\e%-12345X\r\n\ez\r\n"' | nc 192.168.0.10 9100

Let's deconstruct this a bit. We use Ruby to print the print job to standard out and netcat to pipe the job to the printer's JetDirect port over the network. As for the job itself:

  • \e%-12345X@PJL - This enters PJL mode. \e is ASCII 27 (1B hex), and Ruby helpfully has an escape sequence for it.
  • @PJL DEFAULT DENSITY=5 - this sets the default density to 5 (the maximum, I think)
  • \e%-12345X - this exits PJL mode.
  • \ez - this prints a test page. Note the Z is lowercase, and the service manual has this backwards.

Each line is separated by a CR+LF (\r\n).

There are a bunch more other defaults you can set. You can read the PCL/PJL specification, or skim through the source code of g2100config like I did.

Hopefully this helps someone configure their old printer.