Patrick Mugabe wrote: > I am using the folllowing code to add a header and footer. It works fine > except that I am failing to align the text on the footer even after > using setAlignment(Element.ALIGN_MIDDLE);
> Paragraph ph = new > Paragraph(ProposalConstants.FOOTERTEXT, arialFont); > ph.setAlignment(Element.ALIGN_MIDDLE); > PdfPCell footerCell = new PdfPCell(ph); > footerCell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); First you set the alignment of ph to align middle. When I see that line, I assume you are going to draw a PdfPCell in composite mode. But no, you create the cell like this: new PdfPCell(ph); In other words: the Paragraph is treated as a Phrase. The cell will be drawn in text mode, and it will be Justified, because you have set the horizontal alignment of the cell to ALIGN_JUSTIFIED. Either switch to composite mode: PdfPCell footerCell = new PdfPCell(); footerCell.addElement(ph); Or remain in text mode, but set the alignment of the cell correctly: PdfPCell footerCell = new PdfPCell(ph); footerCell.setHorizontalAlignment(Element.ALIGN_CENTER); That's all explained on page 168 of the book. br, Bruno ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/