How to use Display PostScript to preview PS?

Jonathan Eunice jonathan at speedy.cs.pitt.edu
Sat Jan 5 09:46:14 AEST 1991


For those of you that do not want to figure out how to redefine 
the showpage operator to pause for input just to get dpsexec to work,
the following PostScript fragment may be helpful.  Put it in a file,
say showpage.ps, and run it before trying to preview PS files.
Whenever the PostScript interpreter runs into a showpage command, it
will pause for a character of input, such as space or return.  Thus
multi-page files can be viewed.

----------- showpage.ps ----------- 
/wait-for-input {
	{ (%stdin) (r) file read	% read from stdin
		{pop exit}			% if char avail, pop and exit
		{exit}			% otherwise EOF, just exit
		ifelse
	} loop				% wait for exit
} def

userdict /oldshowpage			% prepare to add to userdict
systemdict /showpage get		% get guts of showpage routine
put					% oldshowpage now available

/showpage { wait-for-input		% redefine showpage to wait
	    oldshowpage
} def
----------- showpage.ps ----------- 

It would be nice to be able to say

$cat showpage.ps mypostscriptfile.ps | dpsexec

and have that work.  Unfortunately, dpsexec exhibits strange behavior
when I've tried this.  [Anyone who can explain this, I'm curious.]  The
PS run command works considerably better than I/O redirection.  If you
use run, note that it expects absolute pathnames.  Eg:

$dpsexec
PS>(/usr/lpp/DPS/showpage.ps) run
PS>(/usr/lpp/DPS/mypostscriptfile) run



More information about the Comp.unix.aix mailing list