Mohammad Moosa wrote:
> Hi,
> 
> I am creating a PDF file upon user request from web browser.
> 
> In the PDF file we need to add “CONTINUED” text in n-1 pages i.e adding 
> up to last but one page.
> 
> The text should not be added if there is only one page.
> 
> Please help me to solve this problem.

As you're creating the PDF file in a Servlet, you're keeping the file in 
memory (using a ByteArrayOutputStream). Don't add any page numbers in 
the "first pass". Use the bytes from the ByteArrayOutputStream to create 
a PdfReader object. Ask the reader for the number of pages.
If there's only one page, send the bytes to the browser.
If there is more than one page, use PdfStamper to add page numbers from 
page 1 to page n - 1.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to