" I've modified your code a bit and have a question. I have a single page pdf with a form (attached as rider_release.pdf). In my database, I have 100's of entrants (first name, last name, etc..), each of which, need to be completed on the form in the rider_release file. I am trying to take the original document, open it, and while looping through my entrants, populate the form and concatenate to the previous page. So, in the end, I will end up with a 100+ page pdf, each page containing the same page with the exception of the form data.
I've attached the concatenatedPDF file so you can reference my output from the code below. Notice how all pages are empty. The first page still retained the form, while the other two pages did not. Please help when you have time. // begin code public static void main(String[] args) { try { Document document = null; PdfCopy writer = null; // original document (release form for bike riders) PdfReader reader = new PdfReader("c:/temp/rider_release.pdf"); reader.consolidateNamedDestinations(); document = new Document(reader.getPageSizeWithRotation(1)); // my result document of all race waivers concatented writer = new PdfCopy(document, new FileOutputStream("c:/temp/concatenatedPDF.pdf")); writer.setViewerPreferences(PdfWriter.PageModeUseOutlines); document.open(); // simulate looping through 3 bike riders int i = 0; while (i++ < 3) { reader = new PdfReader("c:/temp/rider_release.pdf"); reader.consolidateNamedDestinations(); ByteArrayOutputStream baosPDF = new ByteArrayOutputStream(); // the only way to change the form is with a stamper...? PdfStamper stamper = new PdfStamper(reader, baosPDF); AcroFields form = stamper.getAcroFields(); form.setField("Phone", "402-555-1212"); form.setField("EMail", "jdhank...@cox.net"); form.setField("TODAYS DATE", "4/20/2010"); form.setField("Emergency Contact", "Stephanie Mattoon"); form.setField("RACESACTIVITYIES ENTERED", "Men's Open (CAT1)"); form.setField("City", "Omaha"); form.setField("Name", "Justin Hankins"); form.setField("State", "Nebraska"); form.setField("ANNUAL LICENSE", "123456789"); form.setField("Address", "1620 North 51st"); form.setField("Emergency Contact Phone", "402-555-0558"); form.setField("EVENT DATES", "5/1/2010"); form.setField("RACING AGE as of December 31 2009", "40"); form.setField("Age", "40"); form.setField("CLUBTEAM NAME", "The Wild Hares"); form.setField("Zip", "68104"); form.setField("ChildName", "Justin"); form.setField("EVENT NAME", "Swanson River City Shootout"); PdfImportedPage page = writer.getImportedPage(reader, 1); writer.addPage(page); writer.freeReader(reader); } document.close(); } catch (Exception e) { e.printStackTrace(); } } // end code http://old.nabble.com/file/p28328599/concatenatedPDF.pdf concatenatedPDF.pdf http://old.nabble.com/file/p28328599/rider_release.pdf rider_release.pdf " -- View this message in context: http://old.nabble.com/Mergin-pdfs-tp25058642p28328599.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/