If you search through this mailing list for HeaderFooter, you'll find
many posts similar to this one, posted two weeks ago:

http://www.mail-archive.com/itext-questions@lists.sourceforge.net/msg45755.html

That should point you in the right direction.

---mr. bean



Mark Davidson-5 wrote:
> 
> Ok, so I read through the documentation looking for the answer, I
> couldn't find it there. Hopefully this won't get a [newbie] tag!
> 
> Note: I'm using iText-2.1.7.jar
> 
> Anyways, my problem is that the HeaderFooter class doesn't display
> footer information like I think it should.
> 
> Basically, I'm trying to create a footer that has an email address and
> a phone number on the left side, and the page number on the right
> side. My initial attempt was as follows:
> public static HeaderFooter CreateFooter() throws Exception
> {
>       Smaller = new Font();
>       Smaller.setSize(8);
> 
>       Phrase fBefore = new Phrase(new Phrase("m...@address.com" +
>                               "                                               
>          " +
>                               "                                               
>          " +
>                               "                                            
> Page #"));
>       fBefore.setFont(Smaller);
>               
>       Phrase fAfter = new Phrase("\r\nxX-XXXX (X-XXXX)\r\n");
>       fAfter.setFont(Smaller);
>               
>       return new HeaderFooter(fBefore, fAfter);
> }
> 
> This results in HF_Bad.png (attached). It applies the smaller font to
> the page number, but neither the fBefore or fAfter objects.
> 
> My solution was to extend the HeaderFooter class, and overwrite the
> paragraph method as follows:
> 
> public Paragraph paragraph()
> {
>       Paragraph p = new Paragraph();
>       p.add(new Chunk(getBefore().getContent(), getBefore().getFont()));
> 
>       p.add(new Chunk(   (m_iPage++/2 + 1)  + "", getBefore().getFont()));
>       p.add(new Chunk(getAfter().getContent(), getAfter().getFont()));
>               
>       return p;
> }
> 
> The m_iPage is a pagenumber workaround I used (since the Page number
> variable isn't visible). Don't worry, it works! Anyways, when I use
> this implementation of HeaderFooter (I called it MyHeaderFooter), I
> get HF_Good.png (attached).
> 
> Am I making a mistake? It seems that there's something wrong in the
> library where the assigned fonts don't get applied.
> 
> Thank you for taking the time to read my email.
> -Mark Davidson
> 
>  
>  
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a limited time, 
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full
> prize  
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> 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/
> 

-- 
View this message in context: 
http://www.nabble.com/HeaderFooter-question-tp24432362p24432698.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
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