Format:PJL and PCL
| Magic | 1B 25 2D 31 32 33 34 35 58 40 50 4A 4C (UEL + "@PJL"); 1B 45 1B for PCL 5 reset |
|---|---|
| Extensions | .prn, .pcl |
| On this wiki | Facts · Code · Notes · Topics |
Printer job streams sent to laser printers: PJL (Printer Job Language) commands framed by the Universal Exit Language escape sequence ESC %-12345X, which then switch the printer into PCL 5, PCL XL (PCL 6), PostScript or a vendor language with @PJL ENTER LANGUAGE.
Print job envelope
A raw print job usually starts with the Universal Exit Language sequence ESC % - 1 2 3 4 5 X (hex 1B 25 2D 31 32 33 34 35 58), followed by @PJL command lines, for example @PJL ENTER LANGUAGE=..., then the page data in the selected language, and ends with another UEL. file(1) identifies this as HP Printer Job Language data. The language name appears at an arbitrary position within the first 10000 bytes and in arbitrary case, so a scanner has to search for it rather than test a fixed offset. See Fact:PJL and PCL/identification/PJL language switch.
Languages named in file(1)'s rules: HBPL (Fuji-Xerox Host Based Printer Language), HIPERC (Oki Data), LAVAFLOW (Konica Minolta), QPDL (Samsung), ZJS (HP, Zenographics ZJStream) and FWUPDATE2, which marks an HP printer firmware update file (.ful2). A UEL-wrapped or PJL-framed %! is PostScript (Format:PostScript). Firmware update files are not analysed here.
PCL 5
PCL 5 is a stream of printable text and escape sequences. file(1) recognises a PCL job by ESC E ESC (1B 45 1B: printer reset, then another escape) at offset 0 and, if the third sequence is ESC & l <n> A, names the paper size: 0 default, 1 US executive, 2 US letter, 3 US legal, 26 A4, 80 Monarch, 81 No. 10, 90 DL, 91 C5, 100 B5, and negative values for landscape envelopes. See Fact:PJL and PCL/identification/PCL 5 reset.
PCL XL (PCL 6)
Unverified: a PCL XL stream is introduced, after the PJL ENTER LANGUAGE=PCLXL line, by an ASCII header line such as ) HP-PCL XL;2;0;Comment, where the first byte is the binding format (')' for little endian binary), followed by class and protocol revision numbers; after it come tagged operators and attributes (data type tags such as ubyte, uint16, sint32, real32 and arrays, attribute and operator tags) with no escape sequences. Check an HP PCL XL Feature Reference before parsing.
XPS
Unverified: XPS/OpenXPS (.xps, .oxps) is an Open Packaging Conventions ZIP whose _rels/.rels points to a FixedDocumentSequence part (for example /FixedDocSeq.fdseq), with FixedDocument and FixedPage XML parts and font/image resources. See Format:OOXML, which uses the same package model.
Code & repositories
The signatures come from the file(1) magic database; ghostscript and CUPS filters can convert between these languages and raster (Format:CUPS raster).
- https://github.com/file/file @
4ee5ca8fb938c3168bcededd0ce7c2e03daea485· license: BSD-2-Clause (declared by the contributor for the files used; GitHub reports BSD-2-Clause (read from COPYING; GitHub's detector did not classify it) for the repository)
file(1) magic database: magic/Magdir/printer (PostScript, EPS, PJL, PCL signatures) and magic/Magdir/images (DICOM at offset 128)
Tested on: source read, not run: source reading only · checked 2026-10-19; last activity 2026-10-16