Question

Ugrading the iText PDF library from 2.0.4 to 5.4.1 has broken the existing functionality in my application.

Merging tables into one complex table does not work anymore.

//Creating tables
Table table0 = new Table(2);
Table table1 = new Table(7);
Table table2 = new Table(17);
Table table3 = new Table(24);

//Setting widths for tables
table0.setWidths(widths0);
table3.setWidths(widths);
table1.setWidths(widths1);

//Inserting 3 tables into one
Cell cell;
cell = new Cell(table1);
table0.addCell(cell);
Cell cell2 = new Cell(table2);
table0.addCell(cell2);
Cell cell3 = new Cell(table3);
cell3.setColspan(2);
table0.addCell(cell3);

//Populating cells and data for table1, table2, table3...

//Adding table to my pdf document
document.add(table0);
document.close();

Actual result: table0 which is being added to the document is not showing up at all. (I tried adding tables 1,2,3 separately and they showed up) The same code was working with older version of iText PDF.

BG Info: Also java version has upgraded from 1.5 -> 1.7, jBoss from 4.0.4 -> 6.1, but i consider it is probably not related to my trouble.

Many thanks in advance.

Was it helpful?

Solution

The Table class was removed from iText. It was replaced by PdfPTable. You'll have to change your code. Many years have passed between iText 2.0.4 and 5.4.1.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top