I have a problem with PDF, generated using iText (version 5.5.2). I have a table which should contain various elements, including lists.
However, the list inside the cell is wrongly displayed - it's not rendered at all as list, instead list items are displayed one by another.
So instead
- item1
- item2
- item3
I got
item1item2item3
I'm using the following code:
private static Paragraph list(String... items) {
Paragraph para = new Paragraph();
com.itextpdf.text.List list = new com.itextpdf.text.List(true, 10);
for (String item : items) {
list.add(new ListItem(item));
}
para.add(list);
return para;
}
document.add(list("item1","item2","item3));
PdfPTable table = new PdfPTable(2);
table.addCell("Some list");
table.addCell(list("item1","item2","item3));
document.add(table);
The element that is added to the table is identical to that that is added to the document. The difference is, first is displayed correctly, as list, and second has no list formatting.
What I'm doing wrong here?