I figured out the problem Using a Phrase to create the HeaderFooter (instead
of a Paragraph object) solved the problem.
Change this line:
HeaderFooter header = new HeaderFooter(new Paragraph(headString,
iTextHeadingFont), true);
To this:
HeaderFooter header = new HeaderFooter(new Phrase(headString,
iTextHeadingFont), true);
tamtam18 wrote:
>
> I am creating a header with iText using the HeaderFooter object. The Page
> Number is always appearing on the second line of the header, even though
> there is plenty of room on the first line, and I am not explicitly putting
> a line break there. It seems that this problem only started when upgrading
> from iText 1.2 to iText 2.1.5, but I didn't notice anything obvious in the
> iText source code. Has anyone else had this issue, or knows how to solve
> it?
>
> Sample Code:
> headString = viewReportTitle + "Page: ";
> //Setting the second param to true should append a page number at the
> end of the string
> HeaderFooter header = new HeaderFooter(new Paragraph(headString,
> iTextHeadingFont), true);
> header.setAlignment(Element.ALIGN_CENTER);
> iTextDoc.setHeader(header);
>
> The output appears like this:
>
> Report Title Page:
> 1
>
--
View this message in context:
http://www.nabble.com/HeaderFooter---page-number-printing-on-next-line-tp24185404p24187645.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
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/