Manipulate tables in existing PDF
Contents[ Hide ]
One of the earliest features supported by Aspose.PDF for Java is its capabilities of Working with Tables) and it provides great support for adding tables in PDF files being generated from scratch or any existing PDF files. You also get the capability to dynamically create tables and place them inside PDF file. Starting Aspose.PDF for Java 10.6.0, a new feature of searching and parsing simple tables that already exist in PDF document has been provided. A new class named com.aspose.pdf.TableAbsorber provides these capabilities. The usage of TableAbsorber is very much similar to existing TextFragmentAbsorber class.
The following code snippet shows the steps to update contents in particular table cell.
Features related to this functionality which still need to be implemented.
- One of the customers has requested to fetch the data based on the blocks of table or borders (as given in the diagram) and colors as well.
- Currently TableAbsorber cannot recognize table cell background color now. However we expect to make this improvement in this future and a separate ticket is already created in our issue tracking system.
- Another customer wants to get contents of column in the table. Currently TableAbsorber cannot recognize table without borders, but conversion to XLS works well in such cases. However conversion to XLS is a workaround. An enhancement ticket has been logged to improve TableAbsorber for working with such table types.
- A Customer wants to update table in existing PDF dynamically. Including deleting / insertion of rows. This request is a bit difficult to implement and current implementation of TableAbsorber cannot fulfill such requirements.
- If you have a requirement of looking for text property in Cells or BaseParagraph types, (such types are designed for adding new contents on the page), you must cast BaseParagraph to one of the inherited types. For example next code must help: