Dominic Maricic wrote:
I’ve seen this question asked before, but it wasn’t answered. I am
adding a multiple PdfPTable’s on each page. Inside the table the first
cell calls getPageNumber() so that I can display something like 3.4,
next table would have 3.5, etc where the 3 is the page number. The
problem is that if the last PdfPTable on the page gets bumped to the
next page then it will still have a 3 instead of a 4. This is
obviously occurring because getPageNumber() was called before the
table got bumped to the next page. I tried to create my own PageEvent
but couldn’t get that to work either. Any suggestions on how I could
get this to work? Thanks!
The first thing that comes to mind, is the use of a GenericTag in a Chunk:
http://itextdocs.lowagie.com/docs/com/lowagie/text/pdf/PdfPageEvent.html#onGenericTag(com.lowagie.text.pdf.PdfWriter,%20com.lowagie.text.Document,%20com.lowagie.text.Rectangle,%20java.lang.String)
You add an invisible Chunk to the Cell containing the pagenumber
and upon this event, you get the page number from the writer object,
as well as the PdfContentByte. You write the pagenumber using
showTextAligned at the coordinates retrieved from the Rectangle.
br,
Bruno
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions