Samuel Viana wrote:
Hi
with my experience of one month coding with iText i've come to realize that is
not possible to write to a old page already written after the call to the
document.newPage() method.
Indeed: the page is written to the OutputStream,
there is no turning back.
The problem is that I'm using iText to generate electronic invoices and i am
asking if it is possible in any way to write the total number of pages in all
the pages, kind of type "page 3 of 10". With the process I'm using to generate
the PDFs is not possible to know in advance how many page I will have in total,
only in the end, after the last page is written. Is there any possibility to
write that number - the total of pages generated - in all pages, without using
any kind of prevision of that number, which could result in inaccuricies ?
There are two possibilities:
or you work with a PdfTemplate; see example Page X of Y:
http://itextdocs.lowagie.com/tutorial/directcontent/pageevents/#examples
or you create the PDF in two passes: first you create the doc
without page numbers, then you use PdfReader/PdfStamper to
add 'page X of Y' to each page:
http://itextdocs.lowagie.com/tutorial/general/copystamp/#pdfstamper
br,
Bruno
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions