Forum How do I...?

Nested page numbering

c094728
I'm trying to generate a PDF that contains a bunch of letters in a single PDF. I want each letter to display Page X of Y in the footer to display how many pages in each letter. I can reset the page number before each letter but can't determine the total pages for the letter. I can only print the total pages for the PDF. How would I do this? Can multiple PDF's be merged into one?
c094728
I should add, I'm using the java api passing an input stream. Is there a way to have each html document processed as separate document so that the page numbering would work even though it's being combined in a single PDF.
mikeday
At the moment I think you would need to generate multiple PDF files and combine them into one PDF using a separate tool.
c094728
I was able to do this using the IText open source library. I create the Original PDF using Prince containing 100 letters. I created a hidden Page number on each Page by setting the color to white. Then I read the PDF in one page at a time, Search backwards from the end of the page to find the hidden page number text and based on that add additional text in the footer based on how many pages in each letter using the IText PdfStamper class. So I can print Page 1 of x etc on each letter even though each Letter can be variable length depending on data content. I tried doing PDF concatentation using the IText libary first but it made the PDF huge. (20 times the size as using this method which hardly adds anything to the size).