Hi all,
In order to stop adding rows (actually Cells) to a table, I want to
retrieve the height of the PdfPTable. But although there are quite a few
methods, none of them seems to work properly.
PdfPTable table = new PdfPTable(5);
table.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
table.setWidthPercentage(100.0f);
table.setWidths(new int[]{2, 2, 2, 2, 1});
for(int i=0; i<10; i++) {
for(int j=0; j<4; j++) {
table.addCell(new Phrase(someString[i][j], font)); // Strings
of different lengths
}
Image image = Image.getInstance(imageURL);
image.scaleAbsoluteHeight(16);
image.scaleAbsoluteWidth(16);
PdfPCell cell = new PdfPCell(image);
cell.setPadding(1.0f);
cell.setHorizontalAlignment(Cell.ALIGN_LEFT);
cell.setVerticalAlignment(Cell.ALIGN_TOP);
table.addCell(cell);
System.out.println(table.getRow(i).calculateHeights()); // always 4.0
System.out.println(table.getRow(i).getMaxHeights()); // always 4.0
}
table.calculateHeightsFast();
System.out.println(table.getTotalHeight()); // outputs 0.0
Have you any idea, how I can get the real height of a PdfPCell / PdfPTable?
Thanks in advance,
Lars
--
Lars Nagel
Trium Analysis Online GmbH
Hohenlindenerstr. 1
81677 München
Fon : +49 89 2060269 21
Fax : +49 89 2060269 11
Internet: www.trium.de
Amtsgericht Muenchen, HRB 134012
Managing Directors:
Dr. Martin Daumer, Michael Scholz
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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/