From: jgm@cs.brown.edu (Jonathan Monsarrat)
Subject: Re: Break down drawing larger than pagesize ?
Organization: Dept. of Computer Science, Brown University
	<1992Dec21.171203.29295@cs.brown.edu>
	<1992Dec22.025320.5909@leeweyr.sccsi.com>
Date: Tue, 22 Dec 1992 14:25:39 GMT



> Has anybody been able to answer this question in general?

My answer would have been more general if I had used the "save"
and "restore" operators, which can literally wipe all changes to 
memory since the save.

Then it wouldn't matter whether your algorithm uses tons of memory.
This should work on arbitrary pieces of code. Really!

OOPS: My last posted code assumed that you had 11x17 inch paper. 
      At the top of this is a hack to let you set 11x17 if you have it.

-Jon

% example-multipage.ps 
% PostScript Quickie by Jon Monsarrat 1992 jgm@cs.brown.edu
%%%%%%%%%%%  Use the below code to get 11"x17" paper %%%%%%%%%%%%%
%/Pwid 792 def         % page width
%/Pht 1224 def         % page height
%/Margin 23 def                % border margin
%/Clw 15 def           % max-traffic line width
%Pht 792 gt
%    {statusdict /11x17tray known {
%      statusdict begin 11x17tray end
%    }{
%      statusdict /setpageparams known {
%          11 72 mul 17 72 mul 36 1    % w h offs. orientation
%          statusdict begin setpageparams end
%      }{
%          11 17 div dup scale         % for laserwriter
%      } ifelse
%    } ifelse
%  } if

%%%%%%%%%%%%%%%%%% definition of drawit (can be anything) %%%%%%%%%%%%%%%

/drawit    % ignore the complexity of this image. It can be anything.
{

(LcHdBidZi_hdQ6[PaVa1b4c6F"J4b/>$O<)(di_zk{:UFfUg;ABF)(2n>]Eh:u?<)(P"M#R\(:$T<)
([gXfSZ]f\\dZbeZeb^fH;`?dR=ZS7)(K P!U!: H<)(9l9cCf:o?$)(7W4]6`:X;=)(U"W#_%:"R-)
(A 5"<&Y%K"F"M,M,S\)i3e.M5F_PZR9>lP-)(wBxEuEs7x;uBq:q<q>hFh7o:=Nj<)(Z#]#b#:$R-)
(m+m+k3S!R+d,;"^<)(GFP\\RamZf;TAP{X{fd<{C7)(4840N2:6N=)([ Z#^&:!c<)(<%?$C$:#8<)
(D!J"L#:!B<)/a{def}def/M{exch}a/S{repeat}a/Q{{40 add}if}a 18{{}forall/R M a/x 2
/y 3/z 5 3{R M mod 1 eq a}S x Q M y Q moveto 57 sub{3{y Q M x Q M 6 2 roll}S
curveto}S z{fill}{stroke}ifelse}S showpage    % include the showpage!

} bind def

%%%%%%%%%%% Here's some more versatile code %%%%%%%%%%%%

/inch {72 mul} def
/size 6 def     % How much to scale the picture?
% This defines the size of the poster. The output will be scaled to
% approximately (size+1)^2 number of pages for a page-sized image,
% so be wary of printing this out too big. It take a long time.

/virtualh 2.5 def     % The unscaled snoopy fits on an 2.5" height
/virtualw 2.2 def     % The unscaled snoopy fits on an 2.2" width
/actualh 11 def       % The physical pages being printed on are 11" height
/actualw 8.5 def      % The physical pages being printed on are 8.5" width

0 1 size virtualh actualh div mul { /height exch def
        0 1 size virtualw actualw div mul { /width exch def
                   save        % Take a snapshot of memory state
                       -1 actualw mul .5 add inch width mul
                       -1 actualh mul .5 add inch height mul translate
                       size size scale
                       drawit
                   restore     % completely restore the memory
              } for
      } for