S.P.Q.Rahtz@ecs.soton.ac.uk (Sebastian Rahtz) (09/20/90)
A speculative request from Peter Abbott for a method of putting every
other page in his output upside down (this was going to a
phototypesetter, and it helps the plate maker in some way), prompted
me to poke at the facility recently added to dvips by Tom Rokicki,
which allows one to specify a procedure which will be applied to every
page, simply by defining `bop-hook'. It was delightfully easy, and I
offer this short example; put it in `foo.pro' and call dvips with
`-h foo.pro' and away you go:
/Inch {72 mul} def
/PageNo { 0 } def
/bop-hook {
/PageNo PageNo 1 add def %% increment page counter
PageNo 2 mod 0 gt %% see if its an even page
{ } %% do nothing
{ %% otherwise
8.5 Inch 11.65 Inch translate %% go to top right (this is A4 paper)
180 rotate %% turn round and face other way
}
ifelse
} def
Clearly the test for odd/even page could be extended, and the method
used to perform all sorts of use{less,ful} tricks.
It is also very easy to put DRAFT on each page....
/DRAFTSTRING { (DRAFT) } def
/bop-hook { gsave
initmatrix
/Helvetica-Bold findfont setfont
% make size depend on length of string
DRAFTSTRING dup stringwidth pop 8.875 exch div dup 72 mul dup
scale
% placement is on A4
52.3 rotate 2.5 exch div -.35 translate
0.95 setgray
0 0 moveto show
grestore } def
I hope other dvi to PS drivers add this useful facility
sebastian