[iText-questions] Page numbering problem

2004-10-08 Thread Scott Johnston








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










Re: [iText-questions] Page numbering problem

2004-10-08 Thread Steve Appling
I had a similar problem where I wanted to do some special handling of the end of a 
page only when I
was rendering a table.  I handled it by making a class derived from PdfPageEvent that 
has a boolean
member, inTable.

I always set the inTable flag before attaching a table and clear it afterwards.  In 
the onEndPage
method of the event handler, I check the flag and do some special work (drawing 
borders) if it is
set.

The technique for handling Page X of Y is documented in the examples (see 
Chap1004.java).

Good luck.




---
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
___
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions


RE: [iText-questions] Page numbering problem

2004-10-08 Thread Scott Johnston
Thank you so much Steve!  My current code is extremely close to this,
and the onEndPage event is going to save my butt!

Scott Johnston
Salus Systems Ltd.
23-3318 Oak St
Victoria, BC
V8X 1R1
250.370.9963 x23
 

-Original Message-
From: Steve Appling [mailto:[EMAIL PROTECTED] 
Sent: October 8, 2004 1:26 PM
To: Scott Johnston; [EMAIL PROTECTED]
Subject: Re: [iText-questions] Page numbering problem

I had a similar problem where I wanted to do some special handling of
the end of a page only when I
was rendering a table.  I handled it by making a class derived from
PdfPageEvent that has a boolean
member, inTable.

I always set the inTable flag before attaching a table and clear it
afterwards.  In the onEndPage
method of the event handler, I check the flag and do some special work
(drawing borders) if it is
set.

The technique for handling Page X of Y is documented in the examples
(see Chap1004.java).

Good luck.






---
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
___
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions


Re: [iText-questions] Page numbering problem

2004-10-08 Thread Paulo Soares
See the example headers_and_watermarks.java at itextpdf.sf.net.

Best Regards,
Paulo Soares

- Original Message - 
From: Scott Johnston [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, October 08, 2004 19:39
Subject: [iText-questions] Page numbering problem


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

 




---
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
___
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions