Hi all! I am having one problem as seen in attached PDF (source below). I am confused about *different* behaviour of rendering objects after document.add(...) method.
I am using tables and text (Phrase) in my documents. First Phrase (its baseline) is always aligned higher than the others. Is it a bug or feature? ;-) Anyway, I am searching for unified solution. What should I set up in my objects? Thanx in advance. Gabriel Sample code (used for generation of the output): public static void pdfTest() throws Exception { Document doc = new Document(PageSize.A4); PdfWriter writerPDF = PdfWriter.getInstance(doc, new FileOutputStream("c:\\test.pdf")); doc.open(); PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100); PdfPCell pcell = new PdfPCell(new Phrase("Test Table")); pcell.setVerticalAlignment(Element.ALIGN_MIDDLE); pcell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(pcell); Phrase test = new Phrase("JjYyQqGg"); //and here it goes! doc.add(table); //we add table doc.add(test); //we add phrase doc.add(table); //we add table doc.add(test); //we add phrase doc.add(table); //we add table doc.add(test); //we add phrase doc.add(table); //we add table doc.add(test); //we add phrase doc.close(); }
test.pdf
Description: Adobe PDF document