Ok I managed to do this with the following code:
//Header
Phrase phrase = new Phrase (-16);
phrase.add(table);
HeaderFooter header = new HeaderFooter(phrase, false);
header.setBorder(0);
header.setAlignment(Paragraph.ALIGN_CENTER);
document.setHeader(header);
//Footer
HeaderFooter footer = new HeaderFooter(new Phrase("Page ",new
Font(Font.HELVETICA, 8, Font.NORMAL)), new Phrase("",new
Font(Font.HELVETICA, 8, Font.NORMAL)));
footer.setBorder(0);
footer.setAlignment(Paragraph.ALIGN_CENTER);
document.setFooter(footer);
document.open();
Getting page x of y, is going to be a fun ride, can someone make some
suggestions please? Thanks.
davidc2 wrote:
>
> It's too different for a jsp. I was looking into watermarks, and the code
> on a jsp page could be very different from a java class file.
>
> This works:
> HeaderFooter header = new HeaderFooter(new Phrase("Header Header Header",
> false);
> header.setBorder(0);
> header.setAlignment(Paragraph.ALIGN_CENTER);
>
> HeaderFooter footer = new HeaderFooter(new Phrase("This is page "), true);
> footer.setBorder(0);
> footer.setAlignment(Paragraph.ALIGN_CENTER);
>
> document.setHeader(header);
> document.setFooter(footer);
>
> But I can't get a table instead of a Phrase in the HeaderFooter
> constructor, and I can't find how to create a Phrase with tables, but I
> think that's what I'll need.
>
> I'll look into that, I understand it works as an ArrayList, so that is
> probably what I'll need to do.
>
>
> davidc2 wrote:
>>
>> Hey,
>>
>> I'm trying to use a PdfPTable table as a header, but I'm not able to...
>>
>> I'm using
>> PdfPTable table = new PdfPTable(3);
>> on which I'm adding a bunch of cells, and it works, as long as I'm adding
>> it to the Document (document.add(table);)
>>
>> But the only way I'm been able to have a header and a footer on my page
>> is using:
>> HeaderFooter header = new HeaderFooter(new Phrase("Header Header
>> Header"), false);
>>
>> HeaderFooter footer = new HeaderFooter(new Phrase("This is page "),
>> true);
>>
>> document.setHeader(header);
>> document.setFooter(footer);
>>
>> Before document.open...
>>
>> How can I construct HeaderFooter with a table? Or what other alternative
>> do I have?
>>
>> Thanks.
>>
>
>
--
View this message in context:
http://www.nabble.com/Header-Footer-with-iText-on-JSP-tp15768325p15834763.html
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/