Format:PostScript
| Magic | "%!" ("%!PS-Adobe-" for DSC); C5 D0 D3 C6 for DOS EPS |
|---|---|
| Extensions | .ps, .eps, .epsf, .ai |
| On this wiki | Facts · Code · Notes · Topics |
Adobe PostScript page description files (.ps, .eps): text starting %! (conforming files %!PS-Adobe-3.0 with %% DSC comments), optionally preceded by a PJL Universal Exit Language wrapper or a ^D, and Encapsulated PostScript with a binary DOS header whose first bytes are C5 D0 D3 C6.
Recognition
- A PostScript program is text that starts with
%!. Files that follow the Document Structuring Conventions start%!PS-Adobe-followed by the DSC version (for example%!PS-Adobe-3.0) and optionally a type word such asEPS(Encapsulated PostScript); the file(1) magic reads the DSC level from the 3 characters afterPS-Adobe-and a type word (EPS, Query or ExitServer) after that, and finds%%LanguageLevel:within the first 1000 bytes. See Fact:PostScript/identification/Text signatures. - Some PC tools prepend a Ctrl-D (0x04) as a document separator, so
04 25 21also starts PostScript. - Printers receive PostScript wrapped in PJL: the UEL escape sequence
1B 25 2D 31 32 33 34 35 58followed by%!PS, or by@PJLcommands and a later%!; see Format:PJL and PCL.
DOS EPS binary header
Some EPS files (typically from Windows applications that embed a preview) begin with a binary header whose first 4 bytes read as the big-endian value 0xC5D0D3C6 (bytes C5 D0 D3 C6). The file(1) rule checks the 32-bit value at offset 32 is non-zero, then reads two more 32-bit values at offsets 4 and 8 that it labels the byte position and the length of the PostScript section and indirects to the PostScript text at the position in the first. See Fact:PostScript/magic/DOS EPS binary header. Unverified: the header is 30 bytes with little-endian fields (PostScript offset and length, WMF offset and length, TIFF offset and length, checksum); check Adobe Technical Note 5002 before parsing.
Other
Unverified: Adobe Illustrator .ai files before CS are PostScript/EPS with a %!PS-Adobe-3.0 EPSF-3.0 header; later ones are PDF-compatible.
Code & repositories
The signatures come from the file(1) magic database.
- 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