Generating Multipart Document Forms (like carbon paper) [Hard]

   I have hit a wall with XSL-FO, and would like to ask the community for 
suggestions, or a general hint in direction.  Please bear with me, as I 
attempt to give a precise definition of my problem.

   I am generating multi-part forms in XSL-FO, and need something that prints 
4 copies of each page of the generated form.  Each copy will have some 
slightly different content, for instance a message indicating "give this copy 
to so-and-so".  Previously, this document was fed through a dot-matrix 
printer with 4-part carbon paper, and these special messages were pre-printed 
on the paper parts.

   Overall, the actual body of the document should be the same, and any 
special information can appear as static content.

   The printer that will process the resultant document, is loaded with 4-part 
carbonless copy paper.  It consists of pages of different colours, loaded in 
an alternating sequence.  Example, colors A,B,C,D are loaded such that they 
repeat in the sequence {A,B,C,D}, {A,B,C,D}...

   Assume I need messages W,X,Y,Z to print, which will correspond to the 
proper colours.  And imagine I'm printing pages from 1,2,3..N.  I have no 
idea how many generated pages there will be.

   Basically, my desired result is:

A-1-W
B-1-X
C-1-Y
D-1-Z

A-2-W
B-2-X
C-2-Y
D-2-Z

A-3-W
B-3-X
C-3-Y
D-3-Z

   I am completely lost as to how to implement this in XSL-FO.  I could copy 
the result of a single transformation stage into a temporary tree (I'm using 
XSLT 2.0), and then do some further processing.  However, I have no idea how 
many pages I'm generating because of the document flow.  Unless I calculate 
the page area myself, and use single-page documents, I'm lost.

   It seems the only solution would be to manipulate the PDF file directly 
some how, but I'd like to appeal for help first.  I am using FOP.

   Thank you for any suggestions.

   AJ

Received on Friday, 12 May 2006 20:33:16 UTC