Products   Support   Download   Contact

EMBEDDED POSTSCRIPT LANGUAGE RULES

Contents | Index | About the Icons

Abstract

The ScriptServer Printing Systems provide support for embedding PostScript language commands in page descriptions. ScriptServer for OpenVMS supports the use of device control library modules that are sent to the output device at various times during job processing. ScriptServer PAN supports the use of resources that are sent to the output device at various times during job processing. Both ScriptServer Printing Systems support the ability to embed PostScript within a print file, which will be sent to the printer unmodified provided it is appropriately flagged (the line must start with a vertical bar ["|"] characters), and that the embedded PostScript feature is enabled.

The embedded PostScript code must conform to certain rules to prevent it from interfering with the PostScript code generated by ScriptServer software, or the job will fail to print properly.

 

Behavior Rules

Any PostScript language code to be embedded in a ScriptServer print stream should conform to rules known as "well-behaved." These behavior rules are outlined below and are essentially the same as those for creation Encapsulated PostScript (EPS) files. A detailed description of Encapsulated PostScript files is documented in an appendix of the PostScript Language Reference Manual, which can be downloaded in PDF format here.

 

Preserving Graphic Context

When writing PostScript language code to be embedded in another page description, it is important to avoid irreversible graphic transformations and other wholesale modifications to the PostScript environment, such as those caused by the following PostScript operators:


PostScript Stacks and Dictionaries

All PostScript stacks should be returned to the state that they were in before the embedded code executed. This includes the decionary stack, which you should never assume to be in any given state. Any dictionaries created by the embedded PostScript code must be removed from the stack (with the end operator) before the embedded code completes. Failure to do so will generally result in the PostScript error invalidrestore.

 

ScriptServer Graphics State

The PostScript language code generated by ScriptServer software operates in the default PostScript graphics state, where:

Any modification to the graphics state must be placed within a save/restore or gsave/grestore construct.

 

The showpage and copypage Operators

The PostScript operators showpage and copypage are used to cause the current page to be ejected from the printer. As this is generally undesirable in the context of embedded PostScript code, any occurrence of these operators should be removed from the embedded code. Alternately, if the embedded code is operating within a save/restore construct, these operators can be temporarily disabled within the embedded PostScript using code similar to the following code fragment:

/sm$save save def
/showpage {} def
.
.
.
sm$save restore

 

Example

An example of embedding PostScript commands in a text file follows. In this example, the current graphics state is saved, the font is changed to Courier Bold and scaled to 10 points, the string "TOTAL: $100.00" is displayed, and the graphics state restored.

|/mysave save def
|/Courier-Bold findfont 10 scalefont setfont
|550 150 moveto
|(TOTAL: $100.00) show

|mysave restore

 

© 2013 GrayMatter Software Corporation