Thanks Paulo, It worked.. I've added following lines to my test code.
-------------------------------------------
PdfReader readerFinal =
new PdfReader("C:\\Temp\\pdf\\Form2286-Final.pdf"); int totalPages = readerFinal.getNumberOfPages();PdfStamper stamp =
new PdfStamper(readerFinal, new FileOutputStream( "C:\\Temp\\pdf\\Form2286-Last.pdf"));PdfContentByte over;
for(int i=1;i<=totalPages;i++){
over = stamp.getOverContent(i);
over.beginText();
// TINY_FONT defined in constantsover.setFontAndSize(TINY_FONT.getBaseFont(),8);
//set x & y coordinates in matrix==we need page numbers at topover.setTextMatrix(268,finalPage.height() - document.topMargin()-10);
over.showText(
"Page "+i+" of "+totalPages);over.endText();
}
stamp.close();
-----------------------------Srinivas.
On 11/7/06, Paulo Soares <[EMAIL PROTECTED]> wrote:
Build the concatenated doc and then use PdfStamper to insert the page
numbers.
Paulo
----- Original Message -----
From: "Srinivas Hechina" <[EMAIL PROTECTED]>
To: <[email protected] >
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
> [email protected]
> 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
[email protected]
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 [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
