[comp.lang.postscript] Help with possible redef of showpage

west@widgit.enet.dec.com (Jim West (Stealth Contractor)) (05/14/91)

  I'm teaching myself PostScript and have gone thru the 'Tutorial and
Cookbook' and have stumbled my way thru the LRM.

  Here's what I'm trying to accomplish :

    I need the capability to redefine showpage to put a label at the top
  and bottom of every page and to print a running page number on each page
  as well.

    This help is needed for a customer who works in a classified environment
  and needs to put the classification on each page.

    The PostScript files are being generated from various sources (such as
  screen captures, FrameMaker, and others).

    What we would like to do is take these PostScript files and run them
  thru a filter that would add our 'showpage' procedure and then pipe the
  output to the printer.

    Also the customer would like to have a banner and a trailer page printed
  as well (I figured I could just cat the header, file, and trailer to the
  printer).

  I've had success with a small example redefining showpage.  If that's all
there is to it then I think I'm starting to get the hang of PostScript (the
dict's are still quite fuzzy...).  The problem we have with the redefinition
of showpage is that we need each 'original' page scaled down so that there
is not any 'overwriting' of the label and the text from the page.

  Any help that anyone can offer will be greatly appreciated.  Also, what
other books would you all recommend for learning more about PostScript ?

  Much thanx,

					-=> Jim <=-



----------------------------------------------------------------------
 Jim West                      |  The Schainker Converse
 west@widgit.enet.dec.com      |  to Hoare's Law :
                               |
 These are my opinions.        |   Inside every small problem
 Digital has no idea           |     is a larger problem struggling
 what I'm  saying.             |       to get out.
----------------------------------------------------------------------

rossc@extro.ucc.su.OZ.AU (Ross Cartlidge) (05/14/91)

west@widgit.enet.dec.com (Jim West (Stealth Contractor)) writes:


>  I'm teaching myself PostScript and have gone thru the 'Tutorial and
>Cookbook' and have stumbled my way thru the LRM.

>  Here's what I'm trying to accomplish :

>    I need the capability to redefine showpage to put a label at the top
>  and bottom of every page and to print a running page number on each page
>  as well.


Try this prepended to your PS
Hope this helps


%!PS
/page# 0 def
/showpage
[
	{
		initgraphics
		/page# page# 1 add def
		/Courier findfont 12 scalefont setfont
		% Put your stuff here -
		% this just write Page N at 100 100
		100 100 moveto
		(Page    ) dup 5 3 getinterval page# exch cvs pop show
	}
	/exec cvx
	/showpage load
	dup type /operatortype ne
	{
		/exec cvx
	}
	if
]
cvx def

% overload restore because it will change the value of page#
/restore
[
	{
		page#
		exch
	}
	/exec cvx
	/restore load
	dup type /operatortype ne
	{
		/exec cvx
	}
	if
	{
		/page# exch def
	}
	/exec cvx
]
cvx def
-- 
________________________________________________________________________
Ross Rodney Cartlidge			    |   rossc@extro.ucc.su.oz.au
University Computing Service, H08	    |   Phone:     +61 2 6923497
University of Sydney, NSW 2006, Australia   |   FAX:       +61 2 6606557