Hi Deepa,

2009/5/19 Deepa Thakur <deepathakur...@gmail.com>

> Hi,
> I am generating pdf in java using itext. I want to display the different
> headers on different pages. I'm using one single document and pages are
> getting added to it at run time. I have got 5 servlets written to generate
> the whole pdf. At start of every servlet i've written the code for header
> the problem is when its get generated the header gets added to the one more
> extra page.
> to get clear idea i am including the eg below.
> Eg 1-3 pages i want header1 to get display.
> 4-7 pages I want header2 to get display.
> 8-10 Pages I want header3 to get display
> The actual output which i get is as follows.
> 2-4 header1
> 5-8 header2
> 9-10 header3
>
> Even I used the page event method onStartPage for this, but same problem
> continues.
> Below is the code which i'm adding at start of each servlet.
>
> HeaderFooter header = new HeaderFooter(
>                                     new Phrase("ABC", headfont), false);
>                             header.setBorder(Rectangle.NO_BORDER);
>                             header.setAlignment(Element.ALIGN_CENTER);
>                             document.setHeader(header);
>
> Please help me to resolve this issue.
>

Please read the documentation beafore asking again and again the same
question, specially if it's been replied to and you had been asked to
rephrase your question.
For example, in the keywords list [1], you would have looked for the word
"Header" [2], which would have lead you to a full example [3].
Just by reading the short piece of code, you would have realised that :
- the class HeaderFooter SHOULD NOT BE USED, since it's not supported
anymore
- the event used to set the header/footer is onEndPage, not onStartPage
- the PageEvent should be set BEFORE you open the document or create a new
page, not AFTER

Just by reading the documentation, and following the advice I gave you
TWLEVE days ago, you would have this problems solved long ago. It would have
saved you a lot of time.

And please, keep the posts to the list, no need to reply to me personnally.

Cheers,
alexis

[1] http://1t3xt.info/tutorials/keywords/index.php?page=keywords
[2] http://1t3xt.info/tutorials/keywords/index.php?page=keyword&id=290
[3] http://1t3xt.info/examples/browse/?page=example&id=395
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to