Duplex Auto-addressed, Auto-collated,
Dual-paper catalog
By Don Lancaster                                                                   
Version 3.2 February 14, 1998
Copyright c. 1998 by Don Lancaster and Synergetics, Box 809, Thatcher AZ, 85552
(520) 428-4073. synergetics@tinaja.com All commercial rights and all electronic media
rights are *fully* reserved. Linking welcome. Reposting is expressly forbidden.

Consulting services available.
Further support on www.tinaja.com/info01.html  


(The following is believed correct. Please report any errors or differing experiences.)

%!
% DUPLEX CATALOG AUTO-ADDRESSER
% =============================
% by Don Lancaster

% SUMMARY: Tutorial and demo shows how to create a sixteen page
% autoaddressed and auto-collated saddle stitched catalog. Different
% cover and inside page sheets are used. Example code is for HP 4M+

% The GENERAL PROCEDURE for using PostScript-as-language is as % follows:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% In this particular example, the generated code is sent directly
% to a suitable duplexing PostScript printer, such as an HP 4M+.

% The easiest way to send a PostScript file to a PostScript printer
% is with the SEND FILE option of TRANSVERTER PRO.

%%%%%%% (A) CREATE OR IMPORT SOME CATALOG PAGES %%%%%%%%

/nicefont {/Helvetica findfont 10 scalefont setfont} def

% PageA is the outside front and rear covers. Replace these pages
% with real ones. One source is a print-to-disk from Acrobat.

% PageA should be done as a NORMAL PORTRAIT PAGE. PageB through
% PageH should be done as NORMAL LANDSCAPE PAGES.

/PageA {nicefont 220 20 moveto
(This is page 16, the outside rear cover.) show
gsave 390 770 translate 180 rotate 0 0 moveto
(This is page 1, the outside front cover.) show
grestore showpage} def

% PageB is the inside front and rear covers.

/PageB {nicefont gsave 590 160 translate 90 rotate
0 0 moveto (This is page 2) show grestore
gsave 590 558 translate 90 rotate 0 0 moveto
(This is page 15) show grestore showpage} def

% PageC holds document pages 3 and 14...

/PageC {nicefont gsave 590 160 translate 90 rotate
0 0 moveto (This is page 14) show grestore
gsave 590 558 translate 90 rotate 0 0 moveto
(This is page 3) show grestore showpage} def

% Similarly, PageD through PageH hold inside pages in signature
% sequence...

/PageD {nicefont gsave 590 160 translate 90 rotate
0 0 moveto (This is page 4) show grestore
gsave 590 558 translate 90 rotate 0 0 moveto
(This is page 13) show grestore showpage} def

/PageE {nicefont gsave 590 160 translate 90 rotate
0 0 moveto (This is page 12) show grestore
gsave 590 558 translate 90 rotate 0 0 moveto
(This is page 5) show grestore showpage} def

/PageF {nicefont gsave 590 160 translate 90 rotate
0 0 moveto (This is page 6) show grestore
gsave 590 558 translate 90 rotate 0 0 moveto
(This is page 11) show grestore showpage} def

/PageG {nicefont gsave 590 160 translate 90 rotate
0 0 moveto (This is page 10) show grestore
gsave 590 558 translate 90 rotate 0 0 moveto
(This is page 7) show grestore showpage} def

/PageH {nicefont gsave 590 160 translate 90 rotate
0 0 moveto (This is page 8) show grestore
gsave 590 558 translate 90 rotate 0 0 moveto
(This is page 9) show grestore showpage} def

%%%%%%%%%%%%% (B) CATALOG AUTOPRINTER STARTS HERE %%%%%%%%%%%%%%%%%

% Create a working dictinary...

50 dict /Tempdict exch def Tempdict begin

% Set the printer specific parameters. Especially to turn duplex
% on and FORCE TUMBLE (or short edge bind) MODE, and prevent
% any auto tray swapping.

% On the 5M+, we'll put the inside stock in the top tray and the
% cover stock in the lower tray. We'll also use the "old method"
% of setting trays and such...

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% statusdict begin
statusdict /setduplexmode known {true setduplexmode} if
statusdict /settumble known {true settumble} if    % short edge bind!
statusdict /setpapertray known {0 setpapertray} if
% statusdict /setdojamrecovery known {true setdojamrecovery} if
statusdict /settrayswitch known {false settrayswitch} if  % no swapping! end

systemdict /setstrokeadjust known {true setstrokeadjust} if

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

/str 200 string def % workstring for address line

% The address has to be upside down on a normal page so the
% duplexing and folding works. We'll simply use a negative font
% and negative vertical increment here...

/addfont {/Helvetica-Bold findfont -13 scalefont setfont} def

/xpos 300 def        % start of upside down address from bottom left
/ytop 595 def        % start of upside down address from bottom left
                     % chose ytop for attractive 3-line and 5-line adds
/ypos ytop def       % current address line vertical position
/yinc -15 def        % font and spacing are upside down!!!

% addlinetocover places the current valid address line in an
% appropriate position.

/addlinetocover {0 setgray         % verify black
xpos ypos moveto                   % go to new line position
show                               % show line
/ypos ypos yinc                    % set next line
     sub store} def

% printaddressedcatalogs places a sequence of addresses on
% catalogs actually printed by printoneblankcat...

/printaddressedcatalogs {

statusdict begin                      % force lower (cover stock) tray
statusdict /setpapertray known
{0 setpapertray} if end

/datasource catlist dup length        % use address string as read file!
() /SubFileDecode filter def

{addfont datasource str readline      % get one address line

{dup length 3 gt {addlinetocover}     % add to cover if long, {printoneblankcat                     % complete cover if short
/ypos ytop store}ifelse}              % reset top line position

{printoneblankcat exit} ifelse        % complete final catalog
} loop                                % repeat till out of addresses
} def

% printoneblankcat creates either a blank catalog or completes a
% catalog that has been addressed only.

% NOTE: At present time, PageA has to be transparent in the vicinity
% of the address.

% Any number of inside pages can be used, but note that the signature
% sequence changes with the total selected.

/printoneblankcat {

PageA PageB                             % cover pages go here

statusdict begin                        % change to inside paper stock
statusdict /setpapertray known
{3 setpapertray} if end

PageC PageD PageE PageF PageG PageH     % inside pages

statusdict begin                        % change back to cover stock
statusdict /setpapertray known
{0 setpapertray} if end

} def

% printcatalogs is the main supervisory loop. If blank catalogs % are chosen, numcatcopies are produced. If addressedcatalogs are % chosen, enough copies are produced to use up the address list.

/printcatalogs {

blankcatalogs {numcatcopies {printoneblankcat} repeat}
{printaddressedcatalogs} ifelse } def

%%%%% DATA ENTRY FORMAT %%%%%%%%%%%%%

% Enter data in this format (minus leading %%) Note especially there
% is NO return between the parenthesis and the first name and ONE
% return between the last name and the ending parenthesis:

%%
%% /blankcatalogs true def             % blank or addressed?
%% /numcatcopies 3 def                 % number of copies if blank
%%
%% /catlist
%% (Aaron A. Aardvark
%% 1111 Access Road
%% Arlington, AK 11111
%% %% Brian B. Bismark
%% Bodacious Botique
%% 222 Boulder Blvd
%% Benson, BC 22222
%%
%% Clyde C. Calhoun
%% 33 Central Circle
%% Compton, CA 33333
%% %% Doris D. Dogbert
%% 4444 Delevan Drive
%% Dixie, DE 44444
%% ) def
%%
%% printcatalogs
%%

%%%%%%%%% DATA ENTRY GOES BELOW THIS LINE %%%%%%%%%

% Replace what follows with valid data

/blankcatalogs false def          % blank or addressed?
/numcatcopies 1 def               % number of copies if blank

/catlist
(Aaron A. Aardvark
1111 Access Road
Arlington, AK 11111

Brian B. Bismark
Bodacious Botique
222 Boulder Blvd
Benson, BC 22222

Clyde C. Calhoun
33 Central Circle
Compton, CA 33333

Doris D. Dogbert
4444 Delevan Drive
Dixie, DE 44444
) def

printcatalogs                 % this does all the work

quit                          % exit when finished



Copyright c. 1998 by Don Lancaster and Synergetics, Box 809, Thatcher AZ, 85552
(520) 428-4073. synergetics@tinaja.com All commercial rights and all electronic media
rights are *fully* reserved. Linking welcome. Reposting is expressly forbidden.

Consulting services available.
Further support on www.tinaja.com/info01.html  


Please click here to...