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).

<HT>Horizontal Tab
ASCII 9 HEX 09
ALT + 9
<LF>Line Feed
ASCII 10 HEX 0A
ALT + 10 or Enter
<CR>Carirage Return
ASCII 13 HEX 0D
ALT + 13 or Enter
<SP>Space
ASCII 32 HEX 20
ALT + 32 or Space
<ESC>Escape
ASCII 27 HEX 1B
ALT + 27
<FF>Form Feed
ASCII 12 HEX 0C
ALT+12
<WS>White Spaceadd some spaces or horizontal tabs with the CRLF at the end of line

There is a bin file with these characters: pjl-chars

PJL Info

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:
<ESC>%-12345X@PJL
@PJL EXECUTE command
<ESC>%-12345X
Bin RAW download example: pjl-example

Test PJL Support

You can test that your printer support PJL. Send to the printer:
<ESC>%-12345X@PJL
@PJL EXECUTE MAINTENANCEPRINT
@PJL EXECUTE TESTPRINT
@PJL EXECUTE DEMOPAGE
@PJL EXECUTE RESIFONT
@PJL EXECUTE PERMFONT
@PJL EXECUTE PRTCONFIG
<ESC>%-12345X

Download test: test-pjl

Printer should print some test pages.
If print %-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
http://www.lerup.com/printfile/

Works on x64 and x86 windows (Windows 10 too).

  1. Download and install
  2. Run PrintFile as admin
  3. Click Settings, choose on the bottom your printer and click Save
  4. 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
or
type test.pjl > \\%COMPUTERNAME%\PrinterSharedName

You can map network printer to LPT port if you need:
NET USE LPT1: \\%COMPUTERNAME%\PrinterSharedName
persistent:
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>
@PJL INFO ID <CR><LF>
<ESC>%-12345X
printer should response something like:
<ESC>%-12345X@PJL <CR><LF>
@PJL INFO ID <CR><LF>
ID=Brother HL-1660e
<ESC>%-12345X

 

PJL Documentations:
Brother:
https://www.brother.com.au/pdf/support/controlcodes/PCL_Tech_Manual.pdf

Download (PDF, Unknown)

HP:
http://h10032.www1.hp.com/ctg/Manual/bpl13208.pdf

Download (PDF, 2.86MB)