Hi All,

 

Here is my problem:  I have a long PDF that I am generating that consists of many 1 page (normally) reports that consists of a single table.  On most of these pages, I don’t need page numbers to be displayed.  Unfortunately, some of these reports span multiple pages if the table goes to long.  In these cases (and these cases only), I want to display a page number in a header table that I’m already displaying at the top of each page in the report.  I want the page number to have the format “Page X of Y”.

 

Each page of the report has header information that gets displayed by the onStartPage event that gets fired by iText.  My initial attempt at solving this was to estimate whether or not my report will span multiple pages, and how many pages it will be, and then display the page number if it is greater than 1 in the header.  Unfortunately, due to my font type, it is almost impossible for me to estimate the number of pages due to line feeds occurring in the table on some occasions.

 

What I’m hoping to do is when onStartPage gets fired in the middle of my report (ie. If the report has spanned multiple pages), then go back to the previous page and enter the page number at the top of the page.  Is it possible in iText to return to the previous page after onStartPage gets called?

 

Can anyone think of any other better way of predicting or detecting the number of pages in the report?

 

Scott Johnston

Salus Systems Ltd.

23-3318 Oak St

Victoria, BC

V8X 1R1

250.370.9963 x23

 

Reply via email to