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 pages 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.
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.
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 stacka 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:
As shown by Don Lancaster^
at:
http://www.tinaja.com/psutils/divertsp.psl
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
Comments:
file: /Techref/language/ps/showpage.htm, 4KB, , updated: 2009/4/26 10:31, local time: 2024/11/22 13:42,
18.191.237.228:LOG IN
|
©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? <A HREF="http://techref.massmind.org/Techref/language/ps/showpage.htm"> showpage, postscript</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.