Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

Re: [iText-questions] adding page number at the end of each page
using Header Footer

Bruno

2005-05-19

Replies:

Kurakula, Suneetha (HCF) wrote:

> Hi ,
>
>
>
> I am trying to add page number at the end of each page using
>
You are mixing two different approaches.

Or you use the HeaderFooter object WITHOUT PageEvents.
Just set the footer BEFORE document.open()

Or you use onEndPage and add the pagenumber at an
absolute position as is done in the examples:
http://itextdocs.lowagie.com/tutorial/directcontent/pageevents/index.html#examples
This last solution is the best one.
You don't need the HeaderFooter object.

>
>
>   public void onEndPage(PdfWriter writer, Document document)
>
>   {
>
>      try
>
>      {
>
>       HeaderFooter footer = new HeaderFooter(new Phrase("This is
> page "), true);
>
>       footer.setAlignment(Element.ALIGN_CENTER);
>
>         document.setFooter(footer);
>
>
>
>      }
>
>      catch(Exception e)
>
>      {
>
>           e.printStackTrace();
>
>      }
>
>   }
>
>
>
>
>
> I am using Table objects since our data is dynamic and document is
> controlling if it should go to new page or not.
>
> But problem is page number is not displayed in first page and it is
> displaying in second page.Can any one please help me out.?
>
>
>
> Thanks,
>
> Suneetha.
>
>
>
>
>



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
©2008 junlu.com - Jax Systems, LLC, U.S.A.