Document Structuring Conventions
Document Structuring Conventions, or DSC, is a set of standards for PostScript, based on the use of comments, which primarily specifies a way to structure a PostScript file and a way to expose that structure in a machine-readable way.
The need for a structuring convention arises since PostScript is a Turing-complete programming language. There is thus no guaranteed method to do things like determining how many pages long a given document is or how large a given page is, or how to skip to a particular page. The addition of structure, with DSC comments exposing that structure, help provide a document manager the ability to rearrange the pages, print them in any order, or define bounding boxes for each.
DSC serves a second function, specifying a way to tell the document manager to do certain things, like inserting a font or other PostScript code into the file. DSC comments that serve this second function are more akin to preprocessing directives and are not purely comments, and thus require a functioning document manager to have any effect.
DSC is the basis for encapsulated PostScript.
The set of DSC comments can be expanded by a mechanism called the Open Structuring Conventions, which is the basis of early versions of the Adobe Illustrator Artwork file format.
DSC at a glance
DSC comments begin with two percent signs, and consist of a keyword followed by an optional colon, space character and series of arguments. A DSC-conforming document (this one generated by dvips) might begin:
%!PS-Adobe-2.0 %%Creator: dvips(k) 5.95a Copyright 2005 Radical Eye Software %%Title: texput.dvi %%Pages: 1 %%PageOrder: Ascend %%BoundingBox: 0 0 612 792 %%DocumentPaperSizes: Letter %%EndComments
DSC version 3.0 was released on September 25, 1992. The specification states, "Even though the DSC comments are a layer of communication beyond the PostScript language and do not affect the final output, their use is considered to be good PostScript language programming style." Thus, most PostScript-producing programs output DSC-conformant comments along with the code.