1b6cee71dSXin LI 2b6cee71dSXin LI#------------------------------------------------------------------------------ 3*ae316d1dSXin LI# $File: printer,v 1.36 2024/08/27 18:50:57 christos Exp $ 4b6cee71dSXin LI# printer: file(1) magic for printer-formatted files 5b6cee71dSXin LI# 6b6cee71dSXin LI 7b6cee71dSXin LI# PostScript, updated by Daniel Quinlan (quinlan@yggdrasil.com) 8b6cee71dSXin LI0 string %! PostScript document text 9b6cee71dSXin LI!:mime application/postscript 10b6cee71dSXin LI!:apple ASPSTEXT 11b6cee71dSXin LI>2 string PS-Adobe- conforming 12b6cee71dSXin LI>>11 string >\0 DSC level %.3s 13b6cee71dSXin LI>>>15 string EPS \b, type %s 14b6cee71dSXin LI>>>15 string Query \b, type %s 15b6cee71dSXin LI>>>15 string ExitServer \b, type %s 1640427ccaSGordon Tetlow>>>15 search/1000 %%LanguageLevel:\040 17b6cee71dSXin LI>>>>&0 string >\0 \b, Level %s 18b6cee71dSXin LI# Some PCs have the annoying habit of adding a ^D as a document separator 19b6cee71dSXin LI0 string \004%! PostScript document text 20b6cee71dSXin LI!:mime application/postscript 21b6cee71dSXin LI!:apple ASPSTEXT 22b6cee71dSXin LI>3 string PS-Adobe- conforming 23b6cee71dSXin LI>>12 string >\0 DSC level %.3s 24b6cee71dSXin LI>>>16 string EPS \b, type %s 25b6cee71dSXin LI>>>16 string Query \b, type %s 26b6cee71dSXin LI>>>16 string ExitServer \b, type %s 2740427ccaSGordon Tetlow>>>16 search/1000 %%LanguageLevel:\040 28b6cee71dSXin LI>>>>&0 string >\0 \b, Level %s 29b6cee71dSXin LI0 string \033%-12345X%!PS PostScript document 30b6cee71dSXin LI 31b6cee71dSXin LI# DOS EPS Binary File Header 32b6cee71dSXin LI# From: Ed Sznyter <ews@Black.Market.NET> 33898496eeSXin LI# Update: Joerg Jenderek 34898496eeSXin LI# URL: http://fileformats.archiveteam.org/wiki/Encapsulated_PostScript 35898496eeSXin LI# Reference: http://mark0.net/download/triddefs_xml.7z/defs/eps-adobe.trid.xml 36898496eeSXin LI# Note: called "Encapsulated PostScript binary" by TrID and 37898496eeSXin LI# verified partly by ImageMagick `identify -verbose *` as EPT (Encapsulated PostScript with TIFF preview) 38898496eeSXin LI0 belong 0xC5D0D3C6 39898496eeSXin LI# skip DROID fmt-122-signature-id-174.eps fmt-123-signature-id-178.eps fmt-124-signature-id-180.eps 40898496eeSXin LI# by looking for content after header 41898496eeSXin LI# GRR: in version 5.44 unequal and not endian variant not working! 42898496eeSXin LI>32 ulelong >0 DOS EPS Binary File 43898496eeSXin LI!:mime image/x-eps 44898496eeSXin LI# TODO: check that "long" is false on big endian machines 45898496eeSXin LI# Postscript often (850/857) comes after header; so values like: 30 32 or 2788 10644 43350 71828 46898496eeSXin LI>>4 long >0 at byte %d 47898496eeSXin LI# 1 space char after length value to get phrase like "length 263893 PostScript document text" 48898496eeSXin LI>>>8 long >0 length %d 49898496eeSXin LI# PostScript document text handled by ./printer 50898496eeSXin LI>>>>(4.l) indirect x 51898496eeSXin LI# Reference: http://mark0.net/download/triddefs_xml.7z/defs/e/eps-wmf.trid.xml 52898496eeSXin LI# Note: called "Encapsulated PostScript binary (with WMF preview)" by TrID 53898496eeSXin LI# verified partly by XnView `nconvert -info *.EP?` as TIFF epsp 54898496eeSXin LI>>>>12 long >0 at byte %d 55898496eeSXin LI!:ext eps 56898496eeSXin LI# GRR: in file version 5.44 calling indirect of ./msdos produce phrase like "length 452\012- Windows metafile" 57b6cee71dSXin LI>>>>16 long >0 length %d 58898496eeSXin LI# Windows metafile data handled by ./msdos 59898496eeSXin LI>>>>>(12.l) indirect x 60898496eeSXin LI# Reference: http://mark0.net/download/triddefs_xml.7z/defs/e/eps-tiff.trid.xml 61898496eeSXin LI# Note: called "Encapsulated PostScript binary (with TIFF preview)" by TrID 62898496eeSXin LI>>>>20 long >0 at byte %d 63898496eeSXin LI# For the variant with the TIFF preview image sometimes the file extension ept is used 64898496eeSXin LI!:ext eps/ept 65898496eeSXin LI# GRR: in file version 5.44 calling indirect of ./images produce phrase like "length 43320\012- TIFF image data," 66898496eeSXin LI>>>>>24 long >0 length %d 67898496eeSXin LI# TIFF image data handled by ./images 68898496eeSXin LI>>>>>>(20.l) indirect x 69b6cee71dSXin LI 70b6cee71dSXin LI# Summary: Adobe's PostScript Printer Description File 71b6cee71dSXin LI# Extension: .ppd 7248c779cdSXin LI# Reference: https://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf, Section 3.8 73b6cee71dSXin LI# Submitted by: Yves Arrouye <arrouye@marin.fdn.fr> 74b6cee71dSXin LI# 75b6cee71dSXin LI0 string *PPD-Adobe:\x20 PPD file 76b6cee71dSXin LI>&0 string x \b, version %s 77898496eeSXin LI!:ext ppd 78898496eeSXin LI!:mime application/vnd.cups-ppd 79b6cee71dSXin LI 80b6cee71dSXin LI# HP Printer Job Language 81b6cee71dSXin LI0 string \033%-12345X@PJL HP Printer Job Language data 82b6cee71dSXin LI# HP Printer Job Language 83b6cee71dSXin LI# The header found on Win95 HP plot files is the "Silliest Thing possible" 84b6cee71dSXin LI# (TM) 85b6cee71dSXin LI# Every driver puts the language at some random position, with random case 86b6cee71dSXin LI# (LANGUAGE and Language) 87b6cee71dSXin LI# For example the LaserJet 5L driver puts the "PJL ENTER LANGUAGE" in line 10 88b6cee71dSXin LI# From: Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de> 89b6cee71dSXin LI# Rick Richardson <rickrich@gmail.com> 90b6cee71dSXin LI 91b6cee71dSXin LI# For Fuji-Xerox Printers - HBPL stands for Host Based Printer Language 92b6cee71dSXin LI# For Oki Data Printers - HIPERC 93b6cee71dSXin LI# For Konica Minolta Printers - LAVAFLOW 94b6cee71dSXin LI# For Samsung Printers - QPDL 95b6cee71dSXin LI# For HP Printers - ZJS stands for Zenographics ZJStream 96b6cee71dSXin LI>0 search/10000 @PJL\ ENTER\ LANGUAGE=HBPL - HBPL 97b6cee71dSXin LI>0 search/10000 @PJL\ ENTER\ LANGUAGE=HIPERC - Oki Data HIPERC 98b6cee71dSXin LI>0 search/10000 @PJL\ ENTER\ LANGUAGE=LAVAFLOW - Konica Minolta LAVAFLOW 99b6cee71dSXin LI>0 search/10000 @PJL\ ENTER\ LANGUAGE=QPDL - Samsung QPDL 100b6cee71dSXin LI>0 search/10000 @PJL\ ENTER\ LANGUAGE\ =\ QPDL - Samsung QPDL 101b6cee71dSXin LI>0 search/10000 @PJL\ ENTER\ LANGUAGE=ZJS - HP ZJS 102*ae316d1dSXin LI# From: Stefan Thurner <thurners@nicsys.de> 103*ae316d1dSXin LI>&0 search/10000 %! PJL encapsulated PostScript document text 104898496eeSXin LI# Summary: Hewlett-Packard printer firmware update 105898496eeSXin LI# From: Joerg Jenderek 106898496eeSXin LI# URL: https://support.hp.com/us-en/drivers/selfservice/hp-envy-6000e-all-in-one-printer-series/2100187505/model/2100187513 107898496eeSXin LI# Note: firmware update tested with ENVY 6000 All-in-One Printer 108898496eeSXin LI0 string @PJL\ ENTER\ LANGUAGE=FWUPDATE2 HP Printer firmware update 109898496eeSXin LI#!:mime application/octet-stream 110898496eeSXin LI#!:mime application/x-hp-firmware 111898496eeSXin LI# https://ftp.hp.com/pub/softlib/software13/printers/en6000/2214/EN6000_2214B.exe 112898496eeSXin LI# vasari_base_dist_pp1_001.2214B_nonassert_appsigned_lbi_rootfs_secure_signed.ful2 113898496eeSXin LI!:ext ful2 114b6cee71dSXin LI 115b6cee71dSXin LI# HP Printer Control Language, Daniel Quinlan (quinlan@yggdrasil.com) 116b6cee71dSXin LI0 string \033E\033 HP PCL printer data 117b6cee71dSXin LI>3 string \&l0A - default page size 118b6cee71dSXin LI>3 string \&l1A - US executive page size 119b6cee71dSXin LI>3 string \&l2A - US letter page size 120b6cee71dSXin LI>3 string \&l3A - US legal page size 121b6cee71dSXin LI>3 string \&l26A - A4 page size 122b6cee71dSXin LI>3 string \&l80A - Monarch envelope size 123b6cee71dSXin LI>3 string \&l81A - No. 10 envelope size 124b6cee71dSXin LI>3 string \&l90A - Intl. DL envelope size 125b6cee71dSXin LI>3 string \&l91A - Intl. C5 envelope size 126b6cee71dSXin LI>3 string \&l100A - Intl. B5 envelope size 127b6cee71dSXin LI>3 string \&l-81A - No. 10 envelope size (landscape) 128b6cee71dSXin LI>3 string \&l-90A - Intl. DL envelope size (landscape) 129b6cee71dSXin LI 130b6cee71dSXin LI# IMAGEN printer-ready files: 131b6cee71dSXin LI0 string @document( Imagen printer 132b6cee71dSXin LI# this only works if "language xxx" is first item in Imagen header. 133b6cee71dSXin LI>10 string language\ impress (imPRESS data) 134b6cee71dSXin LI>10 string language\ daisy (daisywheel text) 135b6cee71dSXin LI>10 string language\ diablo (daisywheel text) 136b6cee71dSXin LI>10 string language\ printer (line printer emulation) 137b6cee71dSXin LI>10 string language\ tektronix (Tektronix 4014 emulation) 138b6cee71dSXin LI# Add any other languages that your Imagen uses - remember 139b6cee71dSXin LI# to keep the word `text' if the file is human-readable. 140b6cee71dSXin LI# [GRR 950115: missing "postscript" or "ultrascript" (whatever it was called)] 141b6cee71dSXin LI# 142b6cee71dSXin LI# Now magic for IMAGEN font files... 143b6cee71dSXin LI0 string Rast RST-format raster font data 144b6cee71dSXin LI>45 string >0 face %s 145b6cee71dSXin LI# From Jukka Ukkonen 146b6cee71dSXin LI0 string \033[K\002\0\0\017\033(a\001\0\001\033(g Canon Bubble Jet BJC formatted data 147b6cee71dSXin LI 148b6cee71dSXin LI# From <mike@flyn.org> 149b6cee71dSXin LI# These are the /etc/magic entries to decode data sent to an Epson printer. 150b6cee71dSXin LI0 string \x1B\x40\x1B\x28\x52\x08\x00\x00REMOTE1P Epson Stylus Color 460 data 151b6cee71dSXin LI 152b6cee71dSXin LI 153b6cee71dSXin LI#------------------------------------------------------------------------------ 154b6cee71dSXin LI# zenographics: file(1) magic for Zenographics ZjStream printer data 155b6cee71dSXin LI# Rick Richardson <rickrich@gmail.com> 156b6cee71dSXin LI0 string JZJZ 157b6cee71dSXin LI>0x12 string ZZ Zenographics ZjStream printer data (big-endian) 158b6cee71dSXin LI0 string ZJZJ 159b6cee71dSXin LI>0x12 string ZZ Zenographics ZjStream printer data (little-endian) 160b6cee71dSXin LI 161b6cee71dSXin LI 162b6cee71dSXin LI#------------------------------------------------------------------------------ 163b6cee71dSXin LI# Oak Technologies printer stream 164b6cee71dSXin LI# Rick Richardson <rickrich@gmail.com> 165b6cee71dSXin LI0 string OAK 166b6cee71dSXin LI>0x07 byte 0 167b6cee71dSXin LI>0x0b byte 0 Oak Technologies printer stream 168b6cee71dSXin LI 169b6cee71dSXin LI# This would otherwise be recognized as PostScript - nick@debian.org 170b6cee71dSXin LI0 string %!VMF SunClock's Vector Map Format data 171b6cee71dSXin LI 172b6cee71dSXin LI#------------------------------------------------------------------------------ 173b6cee71dSXin LI# HP LaserJet 1000 series downloadable firmware file 174b6cee71dSXin LI0 string \xbe\xefABCDEFGH HP LaserJet 1000 series downloadable firmware 175b6cee71dSXin LI 176b6cee71dSXin LI# From: Paolo <oopla@users.sf.net> 177b6cee71dSXin LI# Epson ESC/Page, ESC/PageColor 178b6cee71dSXin LI0 string \x1b\x01@EJL Epson ESC/Page language printer data 179898496eeSXin LI 180898496eeSXin LI# Summary: Hewlett-Packard Graphics Language 181898496eeSXin LI# From: Joerg Jenderek 182898496eeSXin LI# URL: http://fileformats.archiveteam.org/wiki/HP-GL 183898496eeSXin LI# https://en.wikipedia.org/wiki/HPGL 184898496eeSXin LI# Reference: http://mark0.net/download/triddefs_xml.7z/defs/h/hpg.trid.xml 185898496eeSXin LI# Note: called "Hewlett-Packard Graphics Language" by TrID and 186898496eeSXin LI# "Hewlett Packard Graphics Language" by DROID via PUID x-fmt/293 and 187898496eeSXin LI# HPGL by XnView command `nconvert -info *` 188898496eeSXin LI# initialize, start a plotting job 189898496eeSXin LI0 string IN; 190898496eeSXin LI>0 use hpgl 191898496eeSXin LI# fill.plt 192898496eeSXin LI0 string INPS 193898496eeSXin LI>0 use hpgl 194898496eeSXin LI# http://ftp.funet.fi/index/graphics/packages/hpgl2ps/hpgl2ps.tar.Z/hpgl2ps/test1.hpgl 195898496eeSXin LI0 string DF; 196898496eeSXin LI>0 use hpgl 197898496eeSXin LI# http://ftp.funet.fi/index/graphics/packages/hpgl2ps/hpgl2ps.tar.Z/hpgl2ps/test3.hpgl 198898496eeSXin LI# Select Pen n; If no pen number or 0, the controller performs an end of file command; n in range between -32767 and 32768 like: 6 199898496eeSXin LI0 string SP 200898496eeSXin LI# skip text Linux-syscall-note inside qemu sources starting with SPDX-Exception-Identifier: Linux-syscall-note 201898496eeSXin LI# by checking for valid Pen number 202898496eeSXin LI>2 regex \^([0-9]{1,5}) 203898496eeSXin LI#>2 regex \^([0-9]{1,5}) PEN_NUMBER=%s 204898496eeSXin LI>>0 use hpgl 205898496eeSXin LI# charsize.hp pages.hp set the scaling points (P1 and P2) to their default positions 206898496eeSXin LI0 string IP0 207898496eeSXin LI>0 use hpgl 208898496eeSXin LI# ci.hp 209898496eeSXin LI0 string CO\040 210898496eeSXin LI>0 use hpgl 211898496eeSXin LI# iw.hp 286x192.5_lh.hpg 286x192.5_lq.hpg 212898496eeSXin LI0 string PS\040 213898496eeSXin LI>0 use hpgl 214898496eeSXin LI# thick.hp 215898496eeSXin LI0 string PS9 216898496eeSXin LI>0 use hpgl 217898496eeSXin LI# ul.hp 218898496eeSXin LI0 string PS4 219898496eeSXin LI>0 use hpgl 220898496eeSXin LI# la.hp 221*ae316d1dSXin LI# Too weak 222*ae316d1dSXin LI#0 string BP 223*ae316d1dSXin LI#>0 use hpgl 224898496eeSXin LI# miter.hp 225898496eeSXin LI# Plot Absolute x,y{,x,y{...}}; x and y in range between -32767 and 32768 like: PA4000,3000; 226898496eeSXin LI0 string PA 227898496eeSXin LI# skip shell scripts test_msa_run_32r5eb.sh test_msa_run_32r5eb.sh with variable PATH_TO_QEMU 228898496eeSXin LI# by checking for valid x coordinate 229898496eeSXin LI>2 regex \^([-]{0,1}[0-9]{1,5}) 230898496eeSXin LI#>2 regex \^([-]{0,1}[0-9]{1,5}) COORDINATE=%s 231898496eeSXin LI>>0 use hpgl 232898496eeSXin LI# pw.hpg number of pens x 233*ae316d1dSXin LI# Too weak 234*ae316d1dSXin LI#0 string NP 235*ae316d1dSXin LI#>0 use hpgl 236898496eeSXin LI# win_1.hp 237898496eeSXin LI#0 string \003INCA WHAT_IS_THAT 238898496eeSXin LI#>0 use hpgl 239898496eeSXin LI# Reference: http://mark0.net/download/triddefs_xml.7z/defs/h/hpgl2.trid.xml 240898496eeSXin LI# Note: called "Hewlett-Packard Graphics Language 2" by TrID 241898496eeSXin LI0 string \033%-1B Hewlett-Packard Graphics Language 2 242898496eeSXin LI!:mime application/vnd.hp-HPGL 243898496eeSXin LI# like: dt.plt 244898496eeSXin LI!:ext plt 245898496eeSXin LI#!:ext plt/gl2/hpg2/spl 246898496eeSXin LI# remaining part after escsape sequnce 247898496eeSXin LI>5 string x with "%-.10s" 248898496eeSXin LI# display Hewlett-Packard Graphics Language vector graphic information 249898496eeSXin LI0 name hpgl 250898496eeSXin LI>0 string x Hewlett-Packard Graphics Language 251898496eeSXin LI#!:mime vector/x-hpgl 252898496eeSXin LI# https://www.iana.org/assignments/media-types/application/vnd.hp-HPGL 253898496eeSXin LI!:mime application/vnd.hp-HPGL 254898496eeSXin LI# no example with HPL suffix found 255898496eeSXin LI!:ext hpgl/hpg/hp/plt 256898496eeSXin LI# like: "IN;" "DF;IN;LT;PU1000,1000;PD2000,10" "SP6;DI0,1;SR0.70,1.90;SC0,800," 257898496eeSXin LI# "CO Concentric circles drawn with different linewidths;" 258898496eeSXin LI>0 string x \b, starting with "%-.54s" 259898496eeSXin LI# continue but not for 1 long line without CR or LF 260898496eeSXin LI>>&0 ubyte <0x0E 261898496eeSXin LI#>>&0 ubyte <0x0E TERMINATOR=%x 262898496eeSXin LI# second line after 1 terminator character 263898496eeSXin LI>>>&0 string >\r with "%-.10s" 264898496eeSXin LI# next character again CR or LF 265898496eeSXin LI>>>&0 ubyte <0x0E 266898496eeSXin LI#>>>&0 ubyte <0x0E 2ND_CHARACTER=%x 267898496eeSXin LI# second line after 2 terminator characters 268898496eeSXin LI>>>>&0 string >\r with "%-.10s" 269