Fun with (Laser) Printers using PJL
Conversing with your Laser Printer:(See disclaimer below)
To extract information from your printer in PJL telnet to its IP address, port 9100 (or by serial, see below), and send it these commands:
<Control+[>%-12345X@PJL <Enter>
Then copy and paste the following commands:
@PJL INFO ID
@PJL INFO CONFIG
@PJL INFO FILESYS
@PJL INFO MEMORY
@PJL INFO PAGECOUNT
@PJL INFO STATUS
@PJL INFO VARIABLES
@PJL INFO USTATUS
Or even try some newer, more detailed but undocumented ones:
@PJL INFO LOG
@PJL INFO PRODINFO
@PJL INFO SUPPLIES
Save your responses, and then type (note: NO <Enter> afterwards):
<Control+[>%-12345X
Then you can disconnect and/or close your Telnet program
Alternately, here is a small BASH script to return all of the information in a dated text file. To use, simply give the script the IP address of the printer as an argument.
#!/bin/bash
#v1.0 – M Lange, 4-Jan-2014
echo -e “Scan of $1 9100 run on `date`:\n——————————-\n” > PJLScan-`date -I`.$1.txt{ echo -e “\033%-12345X@PJL”;
echo @PJL INFO ID;
echo @PJL INFO CONFIG;
echo @PJL INFO FILESYS;
echo @PJL INFO LOG;
echo @PJL INFO MEMORY;
echo @PJL INFO PRODINFO;
echo @PJL INFO STATUS;
echo @PJL INFO SUPPLIES;
echo @PJL INFO VARIABLES;
echo -e “\033%-12345X”;
sleep 5; } | telnet $1 9100 | sed -e ‘s/\r$//’ >> PJLScan-`date -I`.$1.txt
If you could post your results in the comments, or Pastebin them and post the link, I’d be happy to share them. (Feel free to remove serial numbers if you wish; simply replace them with ‘x’s or ‘-‘s.) I’m trying to get a feel for what the most common options and languages are, as an upcoming open-source project has me parsing raw data and sending it to network printers.
The usual disclaimers apply: I’m not responsible for damages caused to your stuff or expenses incurred (i.e ink/toner/paper). Luckily, the worst case scenario is either A) Print out a page with those commands on it, or B) Hog the printer’s I/O until it times out (or you turn it off and then back on). For this reason, I recommend only trying this on a printer to which you *own* and to which you have physical access.
PJL Commands:
Tip: To run a PJL command,
you need to be in PJL mode. If you’re not in PJL mode (ie you typed something that doesn’t begin with an @, you get bumped into raw text mode), you need to send a <Control+[>%-12345X@PJL <Enter>, then you can type your PJL command, beginning with “@”. To end your PJL session, send <Control+[>%-12345X (with no <Enter> after it)
“@PJL” can be used as a command on its own, or rather, a lack of command (or NOOP). It is used after the Escape Code (…%-12345X) to tell the printer you will be typing some PJL. This is necessary because printers sample the code after the Escape Code (…%-12345X) to try to determine what type of data they are receiving (PJL, PCL, PCLXL, PostScript, etc., depending on the model)
HP LaserJet 4M Plus
- Network printer, port 9100
- Personalities: (Auto), PCL, PostScript [optional SIMM installed]
- Info: HP LaserJet 4M Plus Info Dump.doc
HP Color LaserJet CP1518ni:
- Network printer, port 9100
- Personalities: PCL, PCLXL, PostScript
- Info: HP CP1518ni Info Dump.doc
HP Color Laserjet MFP M275nw:
- Connected by ‘Wireless Direct Connect’ and used telnet to port 9100
- Personalities: (Auto), URP, PCL, PDF, PostScript
- Info: HP Color LaserJet MFP M275nw Info Dump.doc
HP LaserJet 1012:
- Plugs in by USB only
- Can interact with it at /dev/usblp0 at 115200,8,n,1 using gtkTerm as root: sudo gtkterm –port /dev/usblp0 –speed 115200 –echo and set “CR LF auto” under the configuration menu
- Interesting: @PJL SET TESTPAGE=DATASTORE is an interesting (4-page) test page, essentially a printout of the value and meaning of all variables
- Personalities: PCL, PCLXL
- Info: HP LaserJet 1012 Info Dump.doc
HP LaserJet 9050:
- Network printer, port 9100
- Interesting: 2MB Flash ROM and a RAMdisk for storage
- Personalities: PCL, PCLXL, PDF, PostScript, MIME, XHTML
- Info: HP LaserJet 9050 Info Dump_redacted.doc
HP Color LaserJet 9500:
- Network printer, port 9100
- Personalities: (Auto), PCL, PDF, PostScript
- Info: HP Color LaserJet 9500 Info Dump_redacted.doc
HP Officejet Pro X476dw MFP:
- Network printer, port 9100
- Filesystem with Read/Write NAND
- Personalities: PCL, PCLXL, PostScript, PDF
- Info: HP Officejet Pro X476dw MFP Info Dump.doc
Brother HL-3040cn:
- Network printer, port 9100
- Personalities: XL2HB
- Info: Brother HL-3040CN Info Dump.doc
Brother MFC-7440n:
- Network printer, port 9100
- Personalities: PCL
- Info: Brother MFC-7440N Info Dump.doc
See also:
- HP LaserJet Series Printers – Common PJL Commands for Front Panel Settings and Default Page Formatting Update: Link Fixed
- PCL, PJL, PS references <- A great list of links to reference material
Please note:
- I would imagine a number of inkjets use PJL, though honestly I have no inkjet printers on-hand to test on. I posit that a number of inkjets will work, including ones with built-in Ethernet. It may be possible to execute commands over USB as with the LaserJet 1012 (See above for serial terminal settings). If anyone has inkjet dumps, they’re just as welcome as Laser ones.