An EPS file must conform to the PostScript Language Document Structuring Conventions (DSC) version 3.0 or later. The DSC are defined in Adobe’s Technical Note 5001, “PostScript Language Document Structuring Conventions Specification”, version 3.0, 25 September 1992, which is the same text as Appendix G of the PostScript Language Reference Manual, Second Edition. This page lists every comment that specification defines, with its arguments as the specification writes them. Which of them an EPS file needs is on the header, comments and previews page.
Syntax
- The first line starts
%!; a conforming file continuesPS-Adobe-3.0. This is the only Adobe comment that does not start with%%. Every other DSC comment starts with%%at the start of a line. - Many keywords end in a colon, which is part of the keyword, not optional. A space should follow the colon, but readers must treat it as optional. White space inside comments is spaces or tabs.
- Keywords and arguments are case-sensitive. Keywords use only letters and the
characters
:,!and?. - No line may exceed 255 characters, not counting the line ending. A long comment
continues on the next line with
%%+. - The header ends at
%%EndComments, or at the first line that does not begin with%followed by a printable character other than space, tab or newline. - Unrecognised comments are ignored. When a header comment appears twice, the first one counts; when a deferred trailer comment appears twice, the last one counts.
- When searching for
%%Traileror deferred comments, a reader must skip nested documents (%%BeginDocument:…%%EndDocument) and data blocks (%%BeginData:…%%EndData).
Argument types
| Type | Meaning |
|---|---|
(atend) | The value is deferred to the %%Trailer section (or, for page comments, after %%PageTrailer), where the same comment appears again with its real arguments. Allowed only in the header and in pages, not in the defaults section. |
<text> | Printable characters, delimited by blanks. In parentheses it may hold blanks and nested parentheses, and the PostScript \ escapes apply. () is an empty string. |
<textline> | As <text> if it starts with (; otherwise the rest of the line. |
<filename> | Any printable characters, system-specific; \ escapes only inside parentheses. |
<fontname> | A font name without the leading /, delimited by blanks, no escapes. |
<formname>, <patternname>, <vectorname> | Names of form, pattern and encoding resources as given to defineresource, for example StandardEncoding. |
<procname> | <name> <version> <revision>: a procedure set name (text), a real version and an unsigned revision. A higher revision of the same version is upwardly compatible. Dummy value 0 when unused. |
<int>, <uint>, <real> | Signed integer, unsigned integer, and real number (optional decimal point and E or e exponent). |
<resource> | font <fontname>, file <filename>, procset <procname>, pattern <patternname>, form <formname> or encoding <vectorname>. <resources> is one type keyword followed by several names. |
Comments that accept (atend): %%BoundingBox:,
%%DocumentCustomColors:, %%DocumentFiles:,
%%DocumentFonts:, %%DocumentNeededFiles:,
%%DocumentNeededFonts:, %%DocumentNeededProcSets:,
%%DocumentNeededResources:, %%DocumentProcSets:,
%%DocumentProcessColors:, %%DocumentSuppliedFiles:,
%%DocumentSuppliedFonts:, %%DocumentSuppliedProcSets:,
%%DocumentSuppliedResources:, %%Orientation:,
%%Pages:, %%PageBoundingBox:,
%%PageCustomColors:, %%PageFiles:,
%%PageFonts:, %%PageOrder:,
%%PageOrientation:, %%PageProcessColors: and
%%PageResources:.
General header comments
| Comment | Arguments | Meaning |
|---|---|---|
%!PS-Adobe-3.0 | [EPSF-3.0 | Query | ExitServer | Resource-<type>] | First line; the file conforms to DSC 3.0. The keyword marks the job type: an EPS file, a query job, a job that runs exitserver or startjob, or a resource file, where the type is Font, File, ProcSet, Pattern, Form or Encoding. Documents for printing use no keyword. |
%%BoundingBox: | llx lly urx ury | (atend) | Integers: the box enclosing all marks on all pages, in default user space (points). |
%%Copyright: | <textline> | Copyright notice of the document or resource. |
%%Creator: | <textline> | Usually the program that made the document. |
%%CreationDate: | <textline> | Date and time, in no set format; informational only. |
%%DocumentData: | Clean7Bit | Clean8Bit | Binary | Byte ranges used. Clean7Bit: 1B–7E plus LF, CR (line ends) and TAB. Clean8Bit: also 80–FF. Binary: any byte. The header itself is always Clean7Bit. |
%%Emulation: | <mode> … | The document invokes an emulator: diablo630, fx100, lj2000, hpgl, impress, hplj or ti855. |
%%EndComments | none | Explicit end of the header. |
%%Extensions: | <extension> … | Level 1 language extensions needed: DPS, CMYK, Composite (composite fonts) or FileSystem. Not needed when the file emulates them or gives %%LanguageLevel: 2. |
%%For: | <textline> | Person, and possibly company, the document is printed for. |
%%LanguageLevel: | <uint> | Required when operators above Level 1 are used without Level 1 emulation. DSC 3.0 defines levels 1 and 2. |
%%OperatorIntervention: | [<password>] | Hold the job until the printer operator releases it, optionally with a password. |
%%OperatorMessage: | <textline> | Message to show on the printer console before printing. Header only. |
%%Orientation: | {Portrait | Landscape} … | (atend) | Portrait: the long edge of the paper is parallel to the y axis; landscape: to the x axis. |
%%Pages: | <uint> | (atend) | Number of virtual pages. 0 for a document that produces no pages, such as an included illustration that does not call showpage. Before 3.0 an optional page order followed (-1 descending, 0 special, 1 ascending); now discouraged in favour of %%PageOrder:. |
%%PageOrder: | Ascend | Descend | Special | (atend) | Order of the pages in the file. Special forbids reordering; with no comment, any reordering is allowed. |
%%Routing: | <textline> | How to return the printout to its owner. |
%%Title: | <textline> | Title of the document. |
%%Version: | <real> <uint> | Version and revision of the document or resource. |
General body comments
| Comment | Arguments | Meaning |
|---|---|---|
%%+ | continuation | Continues the previous comment on a new line. |
%%BeginData: … %%EndData | <uint> [Hex | Binary | ASCII [Bytes | Lines]] | Brackets embedded data so a reader can skip it. The count is physical bytes (white space in hex counts) or lines. Defaults: Binary, Bytes. The procedure call that reads the data (for example image) goes inside the brackets and is counted. |
%%BeginDefaults … %%EndDefaults | none | Page defaults for all pages. After the header and any EPSI preview, before the prolog. May hold only %%PageBoundingBox:, %%PageCustomColors:, %%PageMedia:, %%PageOrientation:, %%PageProcessColors:, %%PageRequirements: and %%PageResources:; a page’s own comment overrides the default. |
%%BeginEmulation: … %%EndEmulation | <mode> | Data in another printer language. The first line invokes the emulator; the line before the end switches back (or the end of file does). |
%%BeginPreview: … %%EndPreview | width height depth lines | The EPSI preview: pixels across and down, bits per pixel (typically 1, 2, 4 or 8), and the number of hex lines. Only in EPS files. |
%%BeginProlog … %%EndProlog | none | The prolog, which holds only procedure-set definitions. %%EndProlog is expected even when the prolog is empty. |
%%BeginSetup … %%EndSetup | none | Document setup (page size, fonts, graphics state that survives initgraphics), after the prolog and before the first page. |
General page comments
| Comment | Arguments | Meaning |
|---|---|---|
%%BeginObject: … %%EndObject | <name> [<code>] | Labels one graphic element of a page; the code can carry, for example, a proofing level. |
%%BeginPageSetup … %%EndPageSetup | none | Setup for one page, directly after %%Page:. |
%%Page: | <label> <ordinal> | Start of a page: any label, then the page’s position in the file, counting from 1. |
%%PageBoundingBox: | llx lly urx ury | (atend) | Box enclosing the marks on this page (or, in the defaults, on every page). |
%%PageOrientation: | Portrait | Landscape | Orientation of this page, or a default in the defaults section. |
General trailer comments
| Comment | Meaning |
|---|---|
%%PageTrailer | End of a page; deferred page comments follow it. |
%%Trailer | Once, at the end of the script; deferred document comments and clean-up follow it. Nested documents can add more, so they must be bracketed. |
%%EOF | End of the document; a document manager sends end-of-file to the interpreter here. |
Requirement header comments
| Comment | Arguments | Meaning |
|---|---|---|
%%DocumentMedia: | <name> <width> <height> <weight> <color> <type> | Each paper used, most used first: a tag name, width and height in points, weight in g/m², colour, and pre-printed form type. Unused values are 0 or (). Defined types: 19HoleCerlox, 3Hole, 2Hole, ColorTransparency, CorpLetterHead, CorpLogo, CustLetterHead, DeptLetterHead, Labels, Tabs, Transparency, UserLetterHead. |
%%DocumentNeededResources: | <resources> | (atend) | Resources used but not contained in the file, each with at least one %%IncludeResource:. Every font must be listed, even ones nearly every printer has. |
%%DocumentSuppliedResources: | <resources> | (atend) | Resources contained in the file, each in a %%BeginResource: pair. Never overlaps the needed list. |
%%DocumentPrinterRequired: | <print> <prod> [<vers> [<rev>]] | Send to this printer: network name and zone, product string or nickname, and optional version and revision. |
%%ProofMode: | TrustMe | Substitute | NotifyMe | What to do when a resource or feature is missing: carry on, substitute (the default), or refuse to print and tell the user. |
%%Requirements: | <requirement>[(<style>,…)] … | Physical needs, in the order they happen: collate, color (style separation), duplex (style tumble), faceup, fax, fold (styles such as letter, z-fold, doublegate, leftgate, rightgate, saddle), jog, manualfeed, numcopies(n), punch(n) (3 assumed), resolution(x,y), rollfed, staple (styles position, orient). Informational only. |
%%VMlocation: | global | local | For resource files: whether the resource works in global VM. |
%%VMusage: | <max> <min> | For resource files: VM used when loaded first, and the least it needs when sharing. |
Requirement body comments
| Comment | Arguments | Meaning |
|---|---|---|
%%BeginDocument: … %%EndDocument | <name> [<version> [<type>]] | A complete conforming document, such as an EPS file, included in another. The parent inherits its resource and feature needs. |
%%IncludeDocument: | <name> [<version> [<revision>]] | The document manager must insert this document here, wrapped in %%BeginDocument:. Called %%ExecuteFile: before 3.0. |
%%BeginFeature: … %%EndFeature | <featuretype> [<option>] | Printer-specific code for a PPD feature, written exactly as in the PPD file, for example *PageSize Legal. |
%%IncludeFeature: | <featuretype> [<option>] | The document manager must insert the PPD code for this feature here. Called %%Feature: before 3.0. |
%%BeginResource: … %%EndResource | <resource> [<max> <min>] | A resource defined in the file, with optional VM usage. |
%%IncludeResource: | <resource> | The document manager must insert this resource here; it must also be in %%DocumentNeededResources:. |
%%EOF | none | Also listed here: where the document manager sends end-of-file. |
Requirement page comments
| Comment | Arguments | Meaning |
|---|---|---|
%%PageMedia: | <medianame> | Paper for this page (or the default), by its name in %%DocumentMedia:. |
%%PageRequirements: | <requirement>[(<style>)] … | Requirements for this page, from the %%Requirements: keywords. |
%%PageResources: | <resources> | (atend) | Resources needed or supplied on this page; procedure sets need not be listed. |
Colour separation comments
| Comment | Arguments | Meaning |
|---|---|---|
%%CMYKCustomColor: | c m y k <colorname> | Approximation of a custom (spot) colour, components 0 to 1 as for setcmykcolor. |
%%RGBCustomColor: | r g b <colorname> | The same as red, green and blue from 0 to 1. |
%%DocumentCustomColors: | <colorname> … | (atend) | Custom colours used; any names except Cyan, Magenta, Yellow and Black, which address a process plate. |
%%DocumentProcessColors: | Cyan | Magenta | Yellow | Black … | (atend) | Process colours used. |
%%BeginCustomColor: … %%EndCustomColor | <colorname> | Code run only for that custom colour’s separation. |
%%BeginProcessColor: … %%EndProcessColor | Cyan | Magenta | Yellow | Black | Code run only for that process colour’s separation. |
%%PageCustomColors: | <colorname> … | (atend) | Custom colours used on the page. |
%%PageProcessColors: | <color> … | (atend) | Process colours used on the page. |
Query comments
Query jobs start %!PS-Adobe-3.0 Query and ask the printer for
information before a document is formatted; they are not used in EPS files. Each query
is a pair of comments starting %%?. The end comment carries a default reply,
which a document manager returns when it cannot answer.
| Comments | Arguments | Asks for |
|---|---|---|
%%?BeginFeatureQuery: … %%?EndFeatureQuery: | <featuretype> [<option>]; end: default | The state of a PPD feature. |
%%?BeginPrinterQuery … %%?EndPrinterQuery: | end: default | Printer product, version and revision. |
%%?BeginQuery: … %%?EndQuery: | <identifier>; end: default | Any other query. |
%%?BeginResourceQuery: … %%?EndResourceQuery: | <resource> …; end: default | Whether resources are available. |
%%?BeginResourceListQuery: … %%?EndResourceListQuery: | font | file | procset | pattern | form | encoding; end: default | All available resources of a type. |
%%?BeginVMStatus … %%?EndVMStatus: | end: default | The result of vmstatus. |
The older %%?BeginFileQuery:, %%?BeginFontQuery:,
%%?BeginFontListQuery and %%?BeginProcSetQuery: pairs are still
described for compatibility.
Special comments
| Comment | Arguments | Meaning |
|---|---|---|
%%BeginExitServer: … %%EndExitServer | <password> | Brackets the code that runs exitserver or startjob, so a document manager can find and remove it. Such jobs start %!PS-Adobe-3.0 ExitServer. Not allowed in EPS files. |
Kept for compatibility
DSC 3.0 still describes these comments but says they may be dropped and that the general resource comments should be used instead. Older EPS files use them often.
| Comment | Arguments | Replaced by |
|---|---|---|
%%DocumentFonts: | <fontname> … | (atend) | All fonts used (needed plus supplied): %%DocumentNeededResources: and %%DocumentSuppliedResources: |
%%DocumentNeededFonts:, %%DocumentSuppliedFonts: | <fontname> … | (atend) | The resource comments with font |
%%DocumentNeededFiles:, %%DocumentSuppliedFiles: | <filename> … | (atend) | The resource comments with file |
%%DocumentProcSets:, %%DocumentNeededProcSets:, %%DocumentSuppliedProcSets: | <procname> … | (atend) | The resource comments with procset |
%%BeginBinary: … %%EndBinary | <bytecount> | %%BeginData: |
%%BeginFile: … %%EndFile, %%IncludeFile: | <filename> | %%BeginResource: file, %%IncludeResource: file |
%%BeginFont: … %%EndFont, %%IncludeFont: | <fontname> [<printername>] | %%BeginResource: font, %%IncludeResource: font |
%%BeginProcSet: … %%EndProcSet, %%IncludeProcSet: | <procname> | %%BeginResource: procset, %%IncludeResource: procset |
%%PageFonts:, %%PageFiles: | names | (atend) | %%PageResources: |
Versions and discontinued comments
- DSC 1.0 required
%%DocumentFonts:,%%EndProlog,%%Page:and%%Trailer. From 2.1 on, no comment is required by the DSC itself (EPS adds its own two). - DSC 2.1 added most of the begin and end pairs, the colour comments,
the file, font and procset comments,
%%PageBoundingBox:,%%PageTrailer,%%ProofMode:,%%Requirements:,%%Routing:and the first queries, and dropped%%ChangeFont:. - DSC 3.0 added
%%BeginData:, the defaults section, emulation,%%BeginPreview:,%%BeginProlog, the general resource comments,%%Copyright:,%%DocumentData:,%%DocumentMedia:,%%Extensions:,%%LanguageLevel:,%%OperatorIntervention:,%%OperatorMessage:,%%Orientation:,%%PageMedia:,%%PageOrder:,%%PageOrientation:,%%PageRequirements:,%%PageResources:,%%Version:,%%VMlocation:,%%VMusage:and the resource queries, and theEPSF-3.0andResource-keywords on the first line. - Discontinued in 3.0:
%%BeginPaperSize:and%%EndPaperSize(use features),%%DocumentPaperColors:,%%DocumentPaperForms:,%%DocumentPaperSizes:and%%DocumentPaperWeights:(use%%DocumentMedia:), and%%PaperColor:,%%PaperForm:,%%PaperSize:and%%PaperWeight:(use%%PageMedia:). In%%Requirements:the optionssimplex,punch3andpunch5were removed. %%HiResBoundingBox:, common in files from Adobe programs, is not in DSC 3.0 or EPSF 3.0; neither document defines it.
Vendor comments
The open structuring conventions let vendors add their own comments: one
%, then a registered prefix of up to five characters (Adobe kept the
register), then anything, to the end of the line, for example
%BCACoverStock: 10129. They may appear anywhere but must not interfere with
DSC parsing.
Source
- PostScript Language Document Structuring Conventions Specification, version 3.0 – Adobe Technical Note 5001, 25 September 1992 (archived copy of Adobe’s partners site)