/showpage { } def
Prepare the Graphics State
In preparation for including an EPS file, the including application must set
the graphics state as follows: current color to black, line caps to square
butt end, line joins to mitered, line width to 1, dash pattern to solid, miter
limit to 10, and the current path should be set to an empty path. This state
can be explicitly set using the following code segment:
0 setgray 0 setlinecap 1 setlinewidth
0 setlinejoin 10 setmiterlimit [ ] 0 setdash newpath
Also, if printing directly to a Level 2 printer, the overprint and stroke adjust
graphics state parameters must be set to
false.
This can be done by condition-
ally using the following code segment:
false setoverprint false setstrokeadjust
Note
If the application knows that any given parameter of the current graphics
state is already in its default state, there is no need to execute the related
PostScript language code to reset that parameter.
Push userdict
It is recommended that an application importing an EPS file use the
begin
operator to push a copy of
userdict
on top of the dictionary stack. Ideally,
the imported EPS file should create its own dictionary, but if it does not, and
if the application’s dictionary does not have enough room for the EPS file’s
definitions, a
dictfull
error may result when the EPS file makes its definitions.
After execution of the EPS file, the application should remove the copy of
userdict
from the dictionary stack by executing the
end
operator.
Clear the Operand Stack
The application importing the EPS file must leave an empty operand stack for
the EPS file. It is reasonable for the EPS file to expect that the entire operand
stack be available for its own use. If the entire operand stack is needed and is
not available, a
stackoverflow
error may occur. Also, if the operand stack is
empty, an EPS file that inappropriately executes
clear
will not cause any
problems.
Protect the Stacks
An EPS file should leave the operand and dictionary stacks as they were
before the EPS file was executed. However, this may not always be the
case. So before including the EPS file, the importing application should be
sure to count the number of objects on the dictionary and operand stacks.
3 Guidelines for Importing EPS Files
15