Thanks for your answer Mark. It works, but there are still problems:
If the font that is used in the header/footer is not used elsewhere in the
document, the font never gets written to the rtf.
If only header or footer is set, not both, a NullPointerException is thrown
in RtfWriter, 4th line in writeSectionDefaults(ByteArrayOutputStream out).
some code to demonstate the problems:
private static void headerTest() throws Exception
{
Document doc = new Document();
RtfWriter.getInstance(doc, new FileOutputStream("headertest.rtf"));
doc.open();
RtfFont arial = new RtfFont("Arial", 32, 0, Color.GREEN);
RtfFont verdana = new RtfFont("Verdana", 22, Font.BOLD, Color.RED);
Paragraph fp = new Paragraph("+abcdefg+ ", arial);
fp.add(new RtfPageNumber("", arial));
RtfHeaderFooter hf = new RtfHeaderFooter(fp);
RtfHeaderFooters header = new RtfHeaderFooters(new Paragraph("", arial),
false);
header.set(RtfHeaderFooters.ALL_PAGES, hf);
doc.setHeader(header);
doc.add(new Paragraph(verdana.getFamilyname(), verdana));
// doc.add(new Paragraph(arial.getFamilyname(), arial));
doc.close();
}
Thanks & Regards,
Thomas
> -----Original Message-----
> From: Mark Hall [mailto:[EMAIL PROTECTED]
> Sent: Saturday, September 06, 2003 2:16 PM
> To: Thomas Bickel; [EMAIL PROTECTED]
> Subject: Re: [iText-questions] RTF headers and footers font
>
>
> On Wednesday 03 September 2003 14:12, Thomas Bickel wrote:
> > Is there a way to change the font family and color for headers and
> > footers in a rtf?
> > I tried everything i could think of but I always get "Times
> New Roman"
> > and black color. Styles and size work fine.
> Try creating the header with a paragraph and setting font
> family and colour
> for the paragraph. That should work.
>
> Greetings,
> Mark
> --
> QOTD:
> "My shampoo lasts longer than my relationships."
>
> My GPG public key is available at:
> http://www.edu.uni-klu.ac.at/~mhall/data/security/MarkHall.asc
>
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions