[EMAIL PROTECTED] wrote:
> Hello,
>
> I generate a PDF document with lots of data.
>
> Here is some sample code:
>
> String docName = Tools.get_tmp_path()+System.currentTimeMillis()+".pdf";
> PdfWriter writer = PdfWriter.getInstance(document, new
> FileOutputStream(docName));
> writer.setPageEvent(new PdfPageEventHelper() {
> public void onStartPage(PdfWriter writer, Document document) {
DO NOT USE onStartPage TO ADD EXTRA DATA.
Please use onEndPage instead.
(For more info, read chapter 14 of the book.)
> }
> });
>
> I add a PdfPageEventHelper to add the page number at the beginning of each
> page. Getting the actual page number is no problem.
> How can I add the page number in the following format: "page x of y" (y
> should be the page count of the document when all the contents was added).
> How can I get the page count of the final document?
See section 14.2.3 conveniently titled "Adding page X of Y".
There are many different ways to achieve this.
Here are some examples (not all):
http://1t3xt.info/examples/browse/?page=example&id=395
http://1t3xt.info/examples/browse/?page=example&id=379
http://1t3xt.info/examples/browse/?page=example&id=223
...
br,
Bruno
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar