Nigel Kibble wrote:


I've been doing some further investigation into the use of templates. Although as you rightly state I can use multiple templates, this doesn't seem to resolve my problem because a template seems to exist for the whole document. I was hoping to have a template per invoice within a document - so the template would have to persist for just a small number of pages within a document.
Do you know of anyway of doing that?

I had to read your question several times before I could understand it.
I try to rephrase the question:

you are creating one single document that contains different parts.
Each part needs to be numbered with 'page X of Y'.
You are using PageEvents to add the 'page X of Y' sentence. In
your events implementation, you use a PdfTemplate to store the Y.
But when you look at the resulting PDF, Y gives you the total number
of pages of the complete document, not the number of pages of each
part separately.

That's because the design of your page events implementation is wrong.

I don't have the time to write an example for you, but you add an
extra method to your page events implementation that creates a new
PdfTemplate (you could call it resetTotalPageNumbers(PdfWriter writer)).
You should keep a reference to your page events instance. Everytime you
want to start a new part in your complete document, call this
resetTotalPageNumbers.

best regards,
Bruno


-------------------------------------------------------
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

Reply via email to