Document Structuring Conventions (DSC)
PS standard does not specify the overall structure of a PS language program. DSC includes information about the document structure and printing requirements in a way that does NOT affect the PS interpreter in any manner.
DSC comments are specified by two percent characters (%%) as the first characters on a line without leading white space. These two percent characters are immediately followed by a unique keyword - not white space. The keyword starts with a capital letter, e.g. BoundingBox. Some keywords end with a colon (part of the keyword) which indicates that the keyword should be provided arguments. One space character should be inserted between ending colon and its arguments.
Example:%%BoundingBox: 10 10 200 200
Resources
http://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf
http://hepunx.rl.ac.uk/~adye/psdocs/DSC.html
http://en.wikipedia.org/wiki/Document_Structuring_Conventions
EPS
"An EPS file is a PS language program describing the appearance of a single page. The purpose of the EPS file is to be included in another PS language page description. The EPS file can contain any combination of text, graphics, and images."
EPS should be DSC-conformant.
EPS file format allows for an optional screen preview image.
Two required DSC header comments are:%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: llx lly urx ury
The first line is the version comment. The second required DSC header comment provides information about size of the EPS file. They are expressed in the default PS coordinate system. For an EPS file, the bounding box is the smallest rectangle that encloses all the marks painted on the single page of the EPS file.
Also, header comments %%Creator:, %%Title:, and %%CreationDate: are recommended.
Coordinate System Transformation
Transform PS coordinate system according to the final placement of the EPS file.
Steps:
(a) Translate the origin of PS coordinate system to the user-chosen origin
(b) Rotate, if the user has rotated the EPS file
(c) Scale
After previous three steps, the lower-left corner of EPS file's bounding box is translated to the user-chosen origin.
Spec: http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf
Bounding box
This piece of information is critical especially when the .ps figures would be inserted into latex document. Bounding box specifies which region the text and figures in ps file occupy. Latex needs this piece of information because it would reserve corresponding space for the content in ps file. It is specified in a single comment line:%%BoundingBox: llx lly urx ury
It appears in the one of the first lines of the .ps file.
Parameters:
- llx
- x coordinate of lower left corner
- lly
- y coordinate of lower left corner
- urx
- x coordinate of upper right corner
- ury
- y coordinate of upper right corner
%%BoundingBox: 50 50 410 302
Note:
(1) Origin of the coordinate system is lower left corner.
(2) Unit of coordinates is Postscript point which is 1/72 of an inch.
A PostScript point is slightly larger than a TEX point, which is 1/72.27 of an inch. In TEX and LATEX, PostScript points are called "big points" and abbreviated bp while TEX points are called "points" and abbreviated pt."(from http://www.physics.ohio-state.edu/~faqomatic/fom-serve/cache/105.html)
(3) 0 0 612 792 is the coordinates of a US Letter–sized page
Resources
http://www.physionet.org/physiotools/plt/plt/html/node47.html
http://amath.colorado.edu/documentation/LaTeX/reference/bbox.html
Additional Resources
Postscript:http://www.tailrecursive.org/postscript/postscript.html
http://hepunx.rl.ac.uk/~adye/psdocs/