Hi - I see that there have been questions on this topic before - how to align text vertically in a PdfPCell. I read the posts but I'm not sure what if anything I'm doing wrong.
The online docs note that "you can't always trust on the vertical alignment." Is there any workaround I can try? I'm running iText 0.92 and Java 1.4 (j2sdk-1.4.0-fcs) from Sun. Compilable excerpt from my source code is below. Thanks in advance very much. Joshua Lerner file align.java: import java.io.FileOutputStream; import java.io.IOException; import java.awt.Color; import com.lowagie.text.*; import com.lowagie.text.pdf.PdfWriter; import com.lowagie.text.pdf.PdfPTable; import com.lowagie.text.pdf.PdfPCell; public class align { public static void main(String[] args) { Document document = new Document(); try { PdfWriter.getInstance(document, new FileOutputStream("align.pdf")); document.open(); Chunk stateCh = new Chunk("New York", FontFactory.getFont(FontFactory.TIMES, 32, Font.NORMAL,Color.white)); Chunk districtCh = new Chunk("District 1", FontFactory.getFont(FontFactory.TIMES, 32, Font.NORMAL, Color.black)); // begin header table PdfPTable table = new PdfPTable(3); table.setWidthPercentage(100); PdfPCell cell = new PdfPCell(new Phrase(stateCh)); // doesn't seem to work cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setColspan(2); cell.setPhrase(new Phrase(stateCh)); cell.setPaddingLeft(11); cell.setBackgroundColor(Color.blue); table.addCell(cell); cell = new PdfPCell(new Phrase(districtCh)); // doesn't seem to work cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setColspan(1); cell.setBackgroundColor(Color.yellow); table.addCell(cell); document.add(table); } catch(DocumentException de) { System.err.println(de.getMessage()); } catch(IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); } } _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions