Printer Job Language (PJL) – that’s a script language to communicate with printer. Every manufacturer has its own commands. There is a few standarized KERNEL commands.
I will describe how to send commands to printer in Windows. I will write all examples based on brother printers because HP has better documentation.
You can include PCL and other languages in PJL files. Just use ENTER PJL command with supported language.
Special characters – you can write it with ALT + CODE where code for <ESC> is 27. If you do not have numpad you should use hex editor like HxD. You can’t send literally <ESC> it has to be 1B in binary hex. In notepad++ it should be like:
LF and CR is just enter in text editor (check editor settings!). In PJL use always: <CR><LF> because printers should ignore all that can’t recognize (f.ex. CR – windows end line).
ASCII 9 HEX 09
|ALT + 9|
ASCII 10 HEX 0A
|ALT + 10 or Enter|
ASCII 13 HEX 0D
|ALT + 13 or Enter|
ASCII 32 HEX 20
|ALT + 32 or Space|
ASCII 27 HEX 1B
|ALT + 27|
ASCII 12 HEX 0C
|<WS>||White Space||add some spaces or horizontal tabs with the CRLF at the end of line|
There is a bin file with these characters: pjl-chars
To run PJL commands you have to prepare file and send it in RAW format to printer. Use only capital letters. You can edit it with Notepad++. For HEX editint use HxD.
Universal format for example PJL:
@PJL EXECUTE command
Bin RAW download example: pjl-example
Test PJL Support
You can test that your printer support PJL. Send to the printer:
@PJL EXECUTE MAINTENANCEPRINT
@PJL EXECUTE TESTPRINT
@PJL EXECUTE DEMOPAGE
@PJL EXECUTE RESIFONT
@PJL EXECUTE PERMFONT
@PJL EXECUTE PRTCONFIG
Download test: test-pjl
Printer should print some test pages.
%-12345X@PJL[...] you have send it in wrong way! (as text no RAW binary file)
Run PJL on Local Printer
To send RAW file to local printer connected via USB, LPT you can use freeware program: PrintFile
Works on x64 and x86 windows (Windows 10 too).
- Download and install
- Run PrintFile as admin
- Click Settings, choose on the bottom your printer and click Save
- Click PrintFile and choose your prepared file. The receiving LED or LCD should say Rece3iving Data (for one second if it is small file).
Run PJL on Network or Local Printer
First run CMD as admin. Change directory to directory with pjl files. Disable firewall for a while.
If your printer is local (USB or LPT) you can make it Network by just sharing the Printer in Windows (set simple name – one word). Then you can run commands to send PJL RAW files in CMD:
copy /b test.pjl \\%COMPUTERNAME%\PrinterSharedName
type test.pjl > \\%COMPUTERNAME%\PrinterSharedName
You can map network printer to LPT port if you need:
NET USE LPT1: \\%COMPUTERNAME%\PrinterSharedNamepersistent:
NET USE LPT1: \\%COMPUTERNAME%\PrinterSharedName /PERSISTENT:YES
If you will install in windows additions (Programs and functions) LPR and LPD service you can use:
lpr -S %COMPUTERNAME% -P PrinterSharedName "-o l" test.pjl
or to the network printer (check the printer working with RAW or something else):
lpr -S 192.168.1.x -P raw "-o l" test.pjl
Receive the response
I do not know how to receive response PJL. I can’t read any output.
There is post how to read PJL responses from printer connected to USB and network devices:PJL ReadBack – read response from printer
For example command:
<ESC>%-12345X@PJL <CR><LF> printer should response something like:
@PJL INFO ID <CR><LF>
@PJL INFO ID <CR><LF>