[comp.lang.postscript] one-up to two-up transformation?

jrk@information-systems.east-anglia.ac.uk (Richard Kennaway CMP RA) (11/30/90)

Help save a tree.  Does there exist a tool which will take a PostScript
file as input and which will generate PostScript output which will print
every two pages on a single page, side-by-side, reduced, and turned
through 90 degrees?

I have some PostScript files that I would like to print in this manner,
but I only have the PostScript, not the input to whatever text formatter
produced them.  (If it matters, then guessing from their appearance,
they are likely TeX and troff, with a few drawings of unknown origin.)
The 'lpr' command for printing them (on a Unix system) doesnt give any
options for doing such a thing.

Please email me; I'll summarise if there's a demand.  I do read this
group, but news reception here is sometimes flaky.

--
Richard Kennaway          SYS, University of East Anglia, Norwich, U.K.
Internet:  jrk@sys.uea.ac.uk		uucp:  ...mcsun!ukc!uea-sys!jrk

rossc@extro.ucc.su.oz.au (Ross Cartlidge) (12/05/90)

jrk@information-systems.east-anglia.ac.uk (Richard Kennaway CMP RA) writes:

>Help save a tree.  Does there exist a tool which will take a PostScript
>file as input and which will generate PostScript output which will print
>every two pages on a single page, side-by-side, reduced, and turned
>through 90 degrees?

>I have some PostScript files that I would like to print in this manner,
>but I only have the PostScript, not the input to whatever text formatter
>produced them.  (If it matters, then guessing from their appearance,
>they are likely TeX and troff, with a few drawings of unknown origin.)
>The 'lpr' command for printing them (on a Unix system) doesnt give any
>options for doing such a thing.

>Please email me; I'll summarise if there's a demand.  I do read this
>group, but news reception here is sometimes flaky.

>--
>Richard Kennaway          SYS, University of East Anglia, Norwich, U.K.
>Internet:  jrk@sys.uea.ac.uk		uucp:  ...mcsun!ukc!uea-sys!jrk

	Try my multi.ps package.
	Anon ftp archive/ps_printing/README.multi from
	archive.su.oz.au

--
________________________________________________________________________
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

pkr@media01.UUCP (Peter Kriens) (12/06/90)

This awk script was posted some time ago. It works wonderfull.
It prints two A4 pages from a conforming postscript file
on one A4.
---------------- cut here -------------------------------
#!/bin/sh
#
# pshalf <files>
#
# Make Postscript output two pages to a page (rotated, approx 1/2 size).
#
# reads stdin or files, writes stdout.  Takes miminally conforming PostScript 
# input and produces minimally conforming PostScript output.
#
# Caveat: the output has mungled around with the showpage operator, which
# means that it cannot be used as input to any other program that must
# capture the showpage operator (for example psdraft, or pshalf itself).
#
# Written by Denise Draper	denise@cwi.nl
#

awk '
BEGIN			{ firsthalf = 1; outpages = 0 }
/^%%Pages:/		{ next }
/^%%PageFonts:/		{ next }
/^%%Page:/		{ if( firsthalf ) {
				if( outpages != 0 )
					print "HfDict begin ep end"
				outpages = outpages + 1
				print "%%Page: ? " outpages
				print "HfDict begin bp end"
			  } else {
				print "HfDict begin hp end"
			  }
			  firsthalf = 1 - firsthalf
			  next
			}
/^%%EndProlog/		{ 
print "% --Pshalf, by Denise Draper--"
print "/HfDict 20 dict def HfDict begin gsave/T matrix currentmatrix matrix"
print "defaultmatrix matrix invertmatrix matrix concatmatrix def initgraphics"
print "clippath pathbbox/y2 exch def/x2 exch def/y1 exch def/x1 exch def/X x2"
print "x1 sub def/Y y2 y1 sub def 90 rotate y1 x1 sub x2 neg translate X Y"
print "div Y X 2 mul div scale matrix currentmatrix/O1D exch def X 0"
print "translate matrix currentmatrix/O2D exch def grestore/nclip{initclip"
print "newpath x1 y1 moveto x1 y2 lineto x2 y2 lineto x2 y1 lineto closepath"
print "clip newpath}def/bp{gsave O1D setmatrix nclip T concat}def/hp{"
print "grestore gsave O2D setmatrix nclip T concat}def/ep{showpage grestore}"
print "bind def end/showpage/newpath load def"
print "% --End Pshalf--"
print "%%Pages: (atend)"
print "%%EndProlog"
			  next
			}
/^%%Trailer/		{ if( outpages != 0 )
				print "HfDict begin ep end"
			  print "%%Trailer"
			  print "%%Pages: " outpages
			  next
			}
			{ print $0 } ' $@