Adobe PostScript Level 2 Language Reference

Operator Types :

Display PostScript Operators File System Operators
CMYK Color Extensions Version 25.0 Operators
Composite Font Extensions Miscellaneous Operators

Display PostScript Operators

Operator Syntax Description
x1 y1 x2 y2 r arct Appends an arc of a circle to the current path.
condition Creates a new condition object.
curentcontext Returns an integer that identifies the current execution context.
gstate currentgstate Replaces the value of gstate object by a copy of the current graphics state and pushes gstate back on the operand stack.
currenthalftone Returns the current halftone dictionary in the graphics state.
currenthalftonephase Returns the current values of the halftone phase parameters in the graphics state.
currentobjectformat Returns the object format parameter currently in effect.
currentshared Has the same semantics as currentlglobal. This operator is defined for compatibility with existing Display PostScript applications.
currentstrokeadjust Returns the current stroke adjust parameter in the graphics state.
index name defineusername Establishes an association between the non-negative integer index and the name object name in the name table.
index any defineuserobject Establishes an association between the non-negative integer index and the object any in the UserObjects array.
context detach Specifies that the execution context identified by the integer context is to terminate immediately when it finishes executing its top-level procedure.
deviceinfo Returns a read-only dictionary containing static information about the current device.
eoviewclip Similar to viewclip, except that it uses the even-odd rule to determine the inside of the current path.
index execuserobject Executes the object associated with the non-negative integer index in the UserObjects array.
mark obj1...obj(n) proc fork Creates a new execution context using the same local and global VM as the current context.
gstate Creates a new graphics state object and pushes it on the operand stack.
x y ineofilluserpath ineofill Similar to infill, but its' insideness test is based on eofill instead of fill.
x y infilluserpath infill The first form returns true if the device pixel containing the (x,y) in user space would be painted by a fill of the current path in the graphics state. Otherwise, it returns false. In the second form, the device pixels that would be painted by filling userpath become an "aperture." This form of the operator returns true if any of the pixels in the aperture would be painted by a fill of the current path in the graphics state. Otherwise is returns false.
initviewclip Replace the current view clipping path with one that encloses the entire imageable area of the output device.
x y instrokeuserpath instroke The first form returns true if the device pixel containing the point (x,y) in user space would be painted by a stroke of the current path in the graphics state. Otherwise, it returns false. In the second form, the device pixels that would be painted by filling userpath become an "aperture." instroke returns true if any of the pixels in the aperture would be painted by a stroke of the current path in the graphics state. Otherwise, it returns false.
x y userpath inueofilluserpath1 userpath2 inueofill Is similar to inufill, but its "insideness" test is based on ueofill instead of ufill.
x y userpath inufilluserpath1 userpath2 inufill The first form returns true if the device pixel containing the point (x,y) in user space would be painted by a ufill of the specified userpath. Otherwise, it returns false. In the second form, the device pixels that would be painted by filling userpath1 become an "aperture." inufill returns true if any of the pixels in the aperture would be painted by a ufill of userpath2. Otherwise, it returns false.
x y userpath inustrokex y userpath matrix inustrokeuserpath1 userpath2 inustrokeuserpath1 userpath2 matrix inustroke The first form returns true if the device pixel containing the point (x,y) in user space would be painted by a ustroke applied to the same operands. Otherwise it returns false. In the second form, inustroke concatenates matrix to the CTM after interpreting the user paths, but before computing the stroke. In the third and fourth forms, the device pixels that would be painted by filling userpath1 become an "aperture." inustroke returns true if any of the pixels in the aperture would be painted by a ustroke of userpath2. Otherwise, it returns false.
context join Waits for the execution context identified by the integer context to finish executing its top-level procedure. It then pushes a mark followed by the entire contents of that context's operand stack onto the current context's operand stack. It then causes the other context to terminate.
lock Creates a new lock object, unequal to any lock object already in existence, and pushes it on the operand stack.
lock proc monitor Acquires lock, first waiting if necessary for it to become free, then executes proc, and finally releases lock again.
condition notify resumes execution off all contexts, if any, that are suspended in a wait for condition.
obj tag printobject Writes a binary object sequence to the standard output file.
x y width height rectclipnumarray rectclipnumstring rectclip Intersects the inside of the current clipping path with a rectangular path the operands describe. In the first form, the operands are four numbers that describe a single rectangle. In the other two forms, the operand is an array or an encoded number string that describes an arbitrary number of rectangles.
x y width height rectfillnumarray rectfillnumstring rectfill Fills a path consisting of one or more rectangles the operands describe. In the first form, the operands are four numbers that describe a single rectangle. In the other two forms, the operand is an array or an encoded number string that describes an arbitrary number of rectangles.
x y width height rectstrokex y width height matrix rectstrokenumarray rectstrokenumarray matrix rectstrokenumstring rectstrokenumstring matrix rectstroke Strokes a path consisting of one or more rectangles the operands describe. In the first two forms, the operands are four numbers that describe a single rectangle. In the remaining forms, the operand is an array or an encoded number string the describes an arbitrary number of rectangles. If the matrix operand is present, rectstroke concatenates matrix to the CTM after defining the path but before stroking it.
x y width height rectviewclipnumarray rectviewclipnumstring rectviewclip Replaces the current view clip with a rectangular path the operands describe. In the first form, the operands are four numbers that describe a single rectangle. In the other two forms, the operand is an array or an encoded number string that describes an arbitrary number of rectangles.
any scheck Has the same semantics as gcheck. This operator is defined for compatibility with existing Display PostScript applications.
key scale selectfontkey matrix selectfont Obtains a font whose name is key, transforms it according to scale or matrix, and establishes it as the current font dictionary in the graphics state.
ll(x) ll(y) ur(x) ur(y) setbbox Establishes a bounding box for the current path, within which the coordinates of subsequent path construction operators must fall. The bounding box is defined by two pairs of coordinates in user space; ll(x) and ll(y) specify the lower-left corner, ur(x), ur(y) the upper-right corner. It is a rectangle oriented with the user space coordinate system axes.
gstate setgstate Replaces the current graphics state by the value of the gstate object.
halftone sethalftone Establishes halftone as the halftone parameter in the graphics state.
x y sethalftonephase Set the halftone phase parameters in the graphics state. X and Y are integers specifying the new halftone phase, interpreted in device space.
int setobjectformat Establishes the number representation to be used in binary object sequences written by subsequent execution of printobject and writeobject.
bool setshared Has the same semantics as setglobal. This operator is defined for compatibility with existing Display PostScript application.
bool setstrokeadjust Set the stroke adjust parameter in the graphics state to bool.
mark blimit setucacheparams Set use path cache parameters as specified by the integer objects above the topmost mark on the stack, then removes all operands and the markobject as if by cleartomark.
int setvmthreshold Sets the allocation threshold used to trigger garbage collections.
sharedict Is the same dictionary as globaldict. The name is defined for compatibility with existing Display PostScript applications.
SharedFontDirectory Is the same dictionary as GlobalFontDirectory. The name is defined for compatibility with existing Display PostScript applications.
userpath uappend Interprets a suer path definition and appends the result to the current path in the graphics state.
ucache Notifies the PostScript interpreter that the enclosing user path is to be retained in the cache if it is not already there.
ucachestatus Reports the current consumption and limit for two user path cache resources.
userpath ueofill Is similar to ufill, but does eofill instead of fill.
userpath ufill Interprets a user path definition and fills the resulting path as if by fill.
dict key undef Removes key and its associated value from the dictionary dict.
key undefinefont Removes key and its associated value from the font directory, reversing the effect of a previous definefont.
index undefineuserobject Breaks the association between the non-negative integer index and an object established by some previous execution of defineuserobject.
bool upath Creates a new user path object that is equivalent to the current path in the graphics state.
UserObjects Returns the current UserObjects array defined in userdict.
userpath ustrokeuserpath matrix ustroke Interprets a user path definition and stokes the resulting path as if by stroke.
userpath ustrokepathuserpath matrix ustrokepath Replaces the current path with one enclosing the shape that would result if the ustroke operator were applied to the same operands.
viewclip Replaces the current view clipping path by a copy of the current path in the graphics state.
viewclippath Replaces the current path by a copy of the current view clipping path.
int vmreclaim Controls the garbage collection machinery as specified by int.
lock condition wait Releases lock, waits for condition to be notified by some other execution context, and finally reacquires lock.
file obj tag writeobject Writes a binary object sequence to file.
wtranslation Returns the translation from the window origin to the PostScript interpreter's device space origin.
string numarray xshowstring numstring xshow Is similar to xyshow. However, for each character shown, xshow extracts only one number from numarray or numstring.
string numarray xyshowstring numstring xyshow Paints successive characters of string in a manner similar to show. After painting each character, it extracts two successive numbers from the array numarray or encoded number string numstring. These two numbers, interpreted in user space, determine the position of the origin of the next character relative to the origin of the character just shown.
yield Suspends the current execution context until all other contexts have had a chance to execute.
string numarray yshowstring numstring yshow Is similar to xyshow. However, for each character shown, yshow extracts only one number from numarray or numstring.

CMYK Color Extensions

Operator Syntax Description
width height bits/comp matrix datasrc(0)... datasrc(n) multi ncomp colorimage Paints a sample image onto the current page.
currentblackgeneration Returns the current black generation function in the graphics state.
currentcmykcolor Returns the current color in the graphics state according to the cyan-magenta-yellow-black color space.
currentcolorscreen Returns the current halftone screen parameters in the graphics.
currentcolortransfer returns the current transfer functions in the graphics state for all four color components.
currentundercolorremoval Returns the current undercolor removal function in the graphics state.
proc setblackgeneration Sets the black generation function parameter in the graphics state.
cyan magenta yellow black setcmykcolor Sets the color space to Device CMYK, then sets the current color parameter in the graphics state to a color described by the parameters cyan, magenta, yellow and black.
redfreq redang redproc greenfreq greenang greenproc bluefreq blueang blueproc grayfreq grayang grayproc setcolorscreen Sets the halftone parameter in the graphics state.
redproc greenproc blueproc grayproc setcolortransfer Sets the transfer function parameter in the graphics state.
proc setundercolorremoval Sets the undercolor removal function parameter in the graphics state.

Composite Font Extensions

Operator Syntax Description
proc string cshow Invokes proc once for each operation of the font mapping algorithm.
key findencoding Obtains an encoding vector identified by the specified key and pushes it onto the operand stack.
rootfont Returns the font that has been selected most recently by setfont or selectfont.
w(0x) w(0y) ll(x) ll(y) ur(x) ur(y) w(1x) w(1y) v(x) v(y) setcachedevice2 Passes two sets of character metrics to the font machinery.

File System Operators

Operator Syntax Description
filename deletefile Removes the specified file from its storage device.
template proc scratch filenameforall Enumerates all files whose names match the specified template string.
file fileposition Returns the current position in an existing open file.
old new renamefile Changes the name of a file from old to new, where old and new are strings that specify file names on the same storage device.
file position setfileposition Repositions an existing open file to a new position so the next read or write operation will commence at that position.

Version 25.0 Operators

(Version 25.0 and later Level 2 Commands)

Operator Syntax Description
currentcacheparams Pushes a mark object followed by the current cache parameters on the operand stack.
currentpacking Returns the array packing mode currently in effect.
any(0)... any(n-1) n packedarray Creates a packed array object of length n containing the objects any(0) through any(n-1) as elements.
mark size lower upper setcacheparams Sets cache parameters as specified by the integer objects above the topmost mark on the stack, then removes all operands and the mark object as if by cleartomark.
bool setpacking Sets the array packing mode to the specified boolean value.

Miscellaneous Operators

Operator Syntax Description
ISOLatin1Encoding Pushes the ISO latin-1 encoding vector on the operand stack.
product This is a read-only string object that is the name of the product in which the PostScript interpreter is running.
realtime Returns the value of a clock that counts in real time, independent of the execution of the PostScript interpreter.
revision This is an integer designating the current revision level of the product in which the PostScript interpreter is running.
serialnumber Returns an integer that purports to represent the specific machine on which the PostScript interpreter is running.
<< Pushes a mark object on the operand stack.
mark key(1) value(1) ... key(n) value(n) >> Creates and returns a dictionary containing the specified key-value pairs.
currentcolor Returns the components, in the current color space, of the color specified by the current color parameters in the graphics state.
currentcolorrendering Returns the value of the CIE based color rendering dictionary parameter in the graphics state.
currentcolorspace Returns an array containing the identifying key and parameters of the color space in the graphics state.
string currentdevparams Returns a dictionary containing the keys and current values of all parameters for the device identified by string.
currentglobal Returns the VM allocation mode currently in effect.
currentoverprint Returns the value of the overprint parameter in the graphics state.
currentpagedevice Returns a read-only dictionary that describes the page-oriented output device in the current graphics state.
currentsystemparameters Returns a dictionary containing the keys and current values of all system parameters that are defined in the implementation.
currentuserparams Returns a dictionary containing the keys and current values of all user parameters that are defined in the implementation.
key instance category defineresource Associates a resource instance with a resource name in a specified category.
form execform Paints a form specified by a constructed form dictionary.
src|tgt param(1)... param(n name filter Creates and returns a filtered file.
key category findresource This attempts to obtain a named resource instance in a specified category.
any gcheck Returns true if the operand is simple or if it is composite and its value resides in global VM. It returns false if the operand is composite and its value resides in local VM.
globaldict Pushes the dictionary object globaldict on the operand stack.
GlobalFontDirectory Pushes a dictionary of defined fonts on the operand stack.
name glyphshow Shows a single character, identified by name, from the current font.
languagelevel This returns an integer designating the PostScript language level supported by the PostScript interpreter.
dict matrix makepattern This verifies that dict is a prototype pattern dictionary with all required key-value pairs.
template proc scratch category resourceforall This enumerates the names of all instances of a specified resource category or a subset selected by template.
key category resourcestatus This returns status information about a named resource instance.
comp(1) comp(2)... comp(n) setcolor Sets the current color parameter in the graphics state to that described the color components in the current color space.
dict setcolorrendering Establishes dict as the current CIE based color rendering dictionary in the graphics state.
array setcolorspacename setcolorspace The first form sets the color space parameter in the graphics state to that described by the specified array or color space name.
string dict setdevparams This attempts to set one or more parameters for the device identified by string according to keys and new values contained in the dict operand.
bool setglobal Sets the VM allocation mode: true denotes global, false denotes local.
bool setoverprint Sets the overprint parameter in the graphics state.
dict setpagedevice Installs a new raster output device in the graphics state based on a combination of the information in the current device and the information found in the dictionary operand.
pattern setpatterncomp(1)... comp(n) pattern setpattern Establishes the specified pattern as the current color in the graphics state.
dict setuserparams Attempts to set one or more user parameters whose keys and new values are contained in the dict operand.
bool password startjob Conditionally starts a new job whose execution may alter the initial VM for subsequent jobs.
undefinedresource A name resource instance sought by findresource cannot be found; that is, no such instance exists either in VM or in external storage.