Hiyas

I've got a PDF with form fields that I want to fill with different
values and, for each database record, fill up a huge PDF with a copy of
the PDF Form I just read and filled out.
The filling of the values works perfectly, but this code here:

  private void copyPages(final byte[] pdfArray, PdfWriter writer) throws 
IOException, DocumentException {
    PdfReader reader = new PdfReader(pdfArray);
    try {
      for (int i=1; i<=reader.getNumberOfPages(); i++) {
        PdfImportedPage importedPage = writer.getImportedPage(reader, i);
        writer.getDirectContent().addTemplate(importedPage, 0, 0);
        writer.newPage();
      }
    }
    finally { writer.freeReader(reader); }
  }

Somehow doesn't want to add a new page in the huge PDF. For each
database record I fetch, it simply puts one page over each other, never
incrementing the page number of the writer (the huge PDF has exactly one
page after everything is written).

Shouldn't newPage() on the PdfWriter create a new page that I can fill
when the next record is found or am I doing something wrong here?

Thanks
Rog

/*
 * Roger Misteli - ABACUS Research AG
 * email: [EMAIL PROTECTED] 
 * Klingon function calls do not have 'parameters' - they have 'arguments'..
 * and they ALWAYS WIN THEM.
 */



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to