please dont rip this site

The Postscript Page Description Language


The showpage command transmits the contents of the current page to the current output device, causing any marks painted on the page to be rendered on the output medium. showpage then erases the current page and reinitializes the graphics state in preparation for composing the next page.

The main actions of showpage are as follows:

1. Executes the EndPage procedure in the page device dictionary, passing an integer page count on the operand stack along with a reason code indicating that the procedure was called from showpage;

2. If the boolean result returned by the EndPage procedure is true, transmits the page’s contents to the current output device and performs the equivalent of an erasepage operation, clearing the contents of raster memory in preparation for the next page. If the EndPage procedure returns false, showpage skips this step.

3. Performs the equivalent of an initgraphics operation, reinitializing the graphics state for the next page.

4. Executes the BeginPage procedure in the page device dictionary, passing an integer page count on the operand stack.

If the BeginPage or EndPage procedure invokes showpage, an undefined error occurs.

BeginPage procedure

An optional, user defined procedure to be executed at the beginning of each page. Before calling the procedure, the interpreter initializes the graphics state, erases the current page if appropriate, and pushes an integer on the operand stack indicating how many times showpage has been invoked since the current device was activated.

EndPage procedure

An optional, user defined procedure to be executed at the end of each page. Before calling the procedure, the interpreter pushes two integers on the operand stack—a count of previous showpage executions for this device and a reason code indicating the circumstances under which this call is being made:

The EndPage procedure is expected to consume these operands. The procedure is permitted to alter the graphics state and to paint marks on the current page; such marks are added to the page just completed.

The procedure must return a boolean value specifying whether to transmit the page image to the physical output device.

Note: The use of BeginPage and EndPage to achieve effects spanning multiple pages sacrifices any page independence the document may have. In general, a page description should not include definitions of BeginPage or EndPage in its invocations of setpagedevice. Instead, a software print manager should prepend such commands to the page description when printing is requested.

With suitable definitions, these procedures can:

Redefining showpage

As shown by Don Lancaster^ at: you can do things to existing PS documents or print jobs by injecting a bit of code that redefines the showpage command to include things you want done to each page. This simple example could probably be better accomplished by changing the EndPage procedure assuming PS2 is being used.

 true setglobal                                               % persist on save/restores
 globaldict begin
/sysshowpage {systemdict /showpage get exec} def

/showpage {						% redefine custom showpage  
% do whatever you want here, e.g. draw a form image (execform) over the printed data from the app.
	sysshowpage					% do the real showpage  
	} def 
 end							% cease persistent
 false setglobal


file: /Techref/language/ps/showpage.htm, 4KB, , updated: 2009/4/26 11:31, local time: 2024/7/18 20:35,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> showpage, postscript</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?


Welcome to!


Welcome to!