I am writing code that generates both PDF and RTF documents, depending on the user\'s selection. The information in both documents is the same.
Until now, we were
From the book iText In Action, end of chapter 6:
If you look at the iText API, you’ll also find some other table classes. com.lowagie.text.Table is the original table class; it dates from the early iText days. It uses class com.lowagie.text.pdf.PdfTable internally to render a table to PDF (don’t confuse this class with PdfPTable).
There’s also the newer SimpleTable class, which tries to form a link between
PdfPTable and Table. It’s able to translate itself to a PdfPTable if you add it to a
document that writes PDF or to a Table if you’re producing HTML or RTF. [...]
The major disadvantage of the Table class is that it’s no longer supported. Different
people have fixed most of the known issues, but today not a single person
understands if and how all the Table-methods work. If you decide to use this class,
you’re more or less on your own, and you’ll encounter lots of quirky layout issues
based on historical design decisions. However, this doesn’t mean you can’t make
good use of the Table class.
Advantages of the Table class
With the Table class, you can generate a table structure that can be rendered in PDF, RTF, and HTML. If you compare the results, you’ll see there are small differences in the way the table is rendered. This is normal; not every table feature is supported in every document format.
As opposed to PdfPTable, you can add cells to a Table in a random order, and add or delete columns if needed. You can even translate a Table to a PdfPTable if you didn’t use setRowspan().
There’s also the SimpleTable, class, which is a simplified version of (PdfP)-Table. When adding a SimpleTable to a PDF document, iText first attempts to add the table as a PdfPTable; if this fails, it’s added as a Table. When adding a SimpleTable to an RTF or HTML document, it’s added as a Table. SimpleTable differs from the Table and PdfPTable in the sense that it reintroduces the concept of rows. This can be handy if you’re parsing an XML file that has a table-row-cell structure. If the tag corresponding with the rows has attributes, you don’t have to define this property for each cell in the row separately; you can set the property for the entire row at once.
Summary
PdfPTable should be your first choice; but depending on the requirements defined for your project, there can be good reasons to opt for Table or SimpleTable.