How The Trick Works
You create a file or enter some Terminal commands, which get sent to the printer. Instead of printing out what you typed, the printer recognizes that the text is actually a set of instructions, known as the Printer Job Language (PJL), which are then carried out by the printer. In this case, we tell the printer to change the message shown on the little display on the printer. So instead of it showing “READY,” you can make it say (almost) whatever you want.
- Authorization to modify printer settings
- Mac or PC
- Networked (JetDirect) HP printer with display
- the PJL file (if you don’t want to make it yourself, or can’t get it to work. Make sure to modify it only in vim )
This may not work on some printers if they are locked down via security settings, but should work on a simple home printer.
Create A File Containing The Commands
In order for the printer to understand that you want it to do something instead of printing a document, the first character needs to be a special character called the escape code. The escape code looks like the carat (^) followed the left bracket ([), but it is not. If you try this trick and just type the carat and left bracket, it won’t work. It needs to be the escape character: ASCII decimal 27, hex 0x1B, or octal 033. This site explains it best:
…If the terminal understands the code, it won’t display the character-sequence, but will perform some action…
So by entering the escape code followed by some commands, it is possible to modify printer settings. There are a few ways to do this. The simplest is using netcat (nc ), but you can also use telnet, ftp, or even by sending it a print job.
The Hardest Part
It would best if you knew how to navigate your way through vim, but it’s not required. I explain each step along the way.
First, open Terminal. Then type vi changeReadyMessage.pjl (or whatever you want to name the file as long as it ends in .pjl)
Press i and you should see the bottom-left corner of the window change to say INSERT. This is a mode that allows you to enter text.
Next, to enter the escape code, type
- hold Control and press “v”
- let go of both keys
- press Control once
- press Escape once
It will appear that a carat and left-bracket get typed out, but it is actually the escape code. You will notice this is true if you press delete as it will delete both characters at once, indicating that it is not really a carat and bracket.
f you did it correctly, the color of the text should be different from everything else that you type (colors may vary depending on your Terminal settings).
If you try to type this in other places like a GUI-based text editor, nothing will happen. It will act the same as pressing the escape key. So you will need to use Terminal to create the file. If you are on Windows, you can use Notepad++ and type 027 while holding Alt to create the escape code.
This step is crucial as the PJL commands will not work if you just type a carat and left-bracket.
Enter The PJL Commands
Immediately after the escape character, type: %-12345X@PJL RDYMSG DISPLAY=”KAMEHAMEHA” replacing the message in quotes with whatever you want as long as it fits these restrictions:
- it can only be 16 characters long
- it can only be a single line
- it cannot contain quotation marks
- it cannot contain spaces
I don’t think this applies to all printers, as you can see from the picture at the beginning of the post that I was able to put spaces in. It probably just depends on the size of the display.
On the next line, enter the escape code again (<CTRL><V><CTRL><ESC>) and then type this directly after it: %-12345X
Your file should now look like this:
^[%-12345X@PJL RDYMSG DISPLAY=”KAMEHAMEHA”
Press Escape once and you will see the INSERT on the bottom-left disappear. Hold Shift and press colon (:). Then, type wq! and press Enter. This will save your file and quit vim .
Check If The File Is Recongized As A .pjl
From Terminal, type file changeReadyMessage.pjl . The output should be:
changeReadyMessage.pjl: HP Printer Job Language data
If it thinks the file is anything else such as ASCII text, it won’t work. It needs to be recognized as HP Printer Job Language data.
Send The File To The Printer
Now that the file is made, it just needs to be sent to the printer. Below are a few different methods to do this.
cat changeReadyMessage.pjl | nc -v -v 10.90.5.20 9100
This method is nice because it doesn’t require an interactive session like FTP does. You can also leave off the -v ‘s if you want to see less output.
Open an FTP session:
Press Enter twice (to leave the username and password fields blank). Then type in these two commands.
put changeReadyMessage.pjl bye