Build the concatenated doc and then use PdfStamper to insert the page numbers.
Paulo ----- Original Message ----- From: "Srinivas Hechina" <[EMAIL PROTECTED]> To: <itext-questions@lists.sourceforge.net> Sent: Tuesday, November 07, 2006 6:59 PM Subject: [iText-questions] Page numbers in concatenated PDFs. > Hi Bruno/Paulo, > Is it possible to insert the page numbers (like Page 1 of 10 etc..) > inside the concatenated PDF using iText Page events? For example, I am > concatenating two pdfs as shown below, and I want the Page numbers to be > inserted in the final concatenated pdf's footer. I tried page event > onEndPage, but its not working.. > > / /code== > > PdfReader reader1 = > *new* PdfReader("C:\\temp\\pdf\\htmlPdf.pdf"); > > PdfReader reader2 = *new* PdfReader("C:\\Temp\\pdf\\2286-Test.pdf"); > > > > PdfCopy writerFinal = > *new* PdfCopy(document, *new* FileOutputStream( "C:\\Temp\\pdf\\2286- > Final.pdf")); > > // setting the pageevent -- for the final PDF.. code for inserting page > numbers is not pasted here(its in onEndPage method)..Does it work with > PDfCopy?? > > writerFinal.setPageEvent(*new* ItextPDFFormDoc()); > > document.open(); > // add pages PdfImportedPage impPage; *for*(*int* i=0; i<pages2;) > > { > > ++i; > > impPage = writerFinal.getImportedPage(reader2,i); > > writerFinal.addPage(impPage); > > System.out.println( > "Processed page -reader2 " + i); > > } > > writerFinal.freeReader(reader2); > *for*(*int* i=0; i<pages1; ) > > { > > ++i; > > impPage = writerFinal.getImportedPage(reader1,i); > > writerFinal.addPage(impPage); > > System.out.println( > "Processed page -reader1 " + i); > > } > > writer.freeReader(reader1); > > document.close(); > > Thanks, > > Srinivas > -------------------------------------------------------------------------------- > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 -------------------------------------------------------------------------------- > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions