jscott@mandata@uunet.uu.net (Jeff Scott) (03/21/91)
On a VAX with LPS40 printers there was an option on the print command to cause the printer to put multiple, shrunk-down page images on a single sheet of paper. Can anyone tell me a general way to change a Postscript file, say from Interleaf, so I can get the same effect on any printer? Since the LPS40 could do this with any Postscript file, I'm guessing that it's something I could add to the start of a normal Postscript file or some way I could modify any Postscript file with, say, an awk script. Jeff Scott jscott%mandata@uunet.uu.net
marc@sequoia.cray.com (Marc Bouron) (03/21/91)
In article <1991Mar20.163533.821@mandata@uunet.uu.net>, jscott@mandata@uunet.uu.net (Jeff Scott) writes: |> On a VAX with LPS40 printers there was an option on the print command to |> cause the printer to put multiple, shrunk-down page images on a single |> sheet of paper. Can anyone tell me a general way to change a Postscript |> file, say from Interleaf, so I can get the same effect |> on any printer? Since the LPS40 could do this with any Postscript file, I'm |> guessing that it's something I could add to the start of a normal Postscript |> file or some way I could modify any Postscript file with, say, an awk script. |> |> Jeff Scott |> jscott%mandata@uunet.uu.net I have a UNIX Bourne shell script which you could probably mangle into DCL (if that's what you need). It intercepts each showpage command, does some scaling and translating, and you end up with four-up output. It doesn't ALWAYS work, but I've never had any incentive to investigate it too far, since the original solution was so simple. Find attached to this message two scripts: PSx4, for four-up output, and PSx2, for two-up. Note that these script write to stdout. They can read from stdin, or from files specified on the command line. [M][a][r][c] ################################################################################ # # marc@sequoia.cray.com # . . # # Marc CR Bouron # M.Bouron@cray.co.uk (ARPA) # _|\ /|_ # # Cray Research (UK) Ltd. # M.Bouron@crayuk.uucp (DOMAIN) # (_|_V_|_) # # +44 344 485971 x2208 # M.Bouron@uk.co.cray (JANET) # | | # # # ...!ukc!crayuk!M.Bouron (UUCP) # # ################################################################################ ----> cut & paste: PSx4 follows ----> #!/bin/sh # # post-processor to produce 4-up output from PostScript input # if [ "$1" = "-?" ] then more /home/uksun401/crmb/man/PSx4.1 exit fi echo "%!PS-Adobe-1.0" echo "%%Title: PSx4 output" echo "/PSshowpage /showpage load def % remember original showpage procedure" echo "/CurrentQuadrant 0 def % current quadrant of the real page" echo "/ResetCTM {" echo " 0 421 translate % move to start of first logical page" echo " 0.5 0.5 scale % reset scale to fit four logical pages" echo " } def" echo "/showpage { % define new showpage procedure" echo " CurrentQuadrant 3 eq { % bottom right" echo " -595 842 translate" echo " PSshowpage" echo " ResetCTM" echo " /CurrentQuadrant 4 def" echo " } if" echo " CurrentQuadrant 2 eq { % bottom left" echo " 595 0 translate" echo " /CurrentQuadrant 3 def" echo " } if" echo " CurrentQuadrant 1 eq { % top right" echo " -595 -842 translate" echo " /CurrentQuadrant 2 def" echo " } if" echo " CurrentQuadrant 0 eq { % top left" echo " 595 0 translate" echo " /CurrentQuadrant 1 def" echo " } if" echo " CurrentQuadrant 4 eq {/CurrentQuadrant 0 def} if" echo " } def" echo "%%EndProlog" echo "ResetCTM" if [ $# -gt 0 ] then for file in $* do file $file | grep PostScript > /dev/null || continue echo "%%BeginDocument" cat $file echo "%%EndDocument" done else read record echo $record | grep '%!' > /dev/null || exit echo "%%BeginDocument" echo $record while read record do echo $record done echo "%%EndDocument" fi echo "% ensure all output is flushed" echo "CurrentQuadrant 0 ne {PSshowpage} if" echo "%%EOF" exit ----> cut & paste: PSx2 follows ----> #!/bin/sh # # post-processor to produce 2-up output from PostScript input # if [ "$1" = "-?" ] then more /home/uksun401/crmb/man/PSx2.1 exit fi echo "%!PS-Adobe-1.0" echo "%%Title: PSx2 output" echo "/PSshowpage /showpage load def % remember original showpage procedure" echo "/CurrentHalfPage 0 def % current half of the real page" echo "/ResetCTM {" echo " 595 0 translate 90 rotate % turn the page on its side" echo " 1 2 sqrt div dup scale % reset scale for two logical pages" echo " } def" echo "/showpage { % define new showpage procedure" echo " CurrentHalfPage 0 eq {" echo " % left page procedure" echo " /CurrentHalfPage 1 def" echo " 595 0 translate" echo " }" echo " {" echo " % right page procedure" echo " PSshowpage" echo " ResetCTM" echo " /CurrentHalfPage 0 def" echo " -595 0 translate" echo " }" echo " ifelse" echo " } def" echo "%%EndProlog" echo "ResetCTM" if [ $# -gt 0 ] then for file in $* do file $file | grep PostScript > /dev/null || continue echo "%%BeginDocument" cat $file echo "%%EndDocument" done else read record echo $record | grep '%!' > /dev/null || exit echo "%%BeginDocument" echo $record while read record do echo $record done echo "%%EndDocument" fi echo "% ensure all output is flushed" echo "CurrentHalfPage 0 ne {PSshowpage} if" echo "%%EOF"