Add Table in Existing PDF Document
Contents
[
Hide
]Tables are important when working with PDF documents. They provide great features for displaying information in a systematic manner. The com.aspose.pdf package contains classes named Table, Cell and Row which provide functionality for creating tables when generating PDF documents from scratch.
In this article, we show how to use these new classes to add a table to an existing PDF.
Adding a Table
To add a table to an existing PDF file with Aspose.PDF for Java, take the following steps:
- Load the source file.
- Initialize a table and set its columns and rows.
- Set table setting (we’ve set the borders).
- Populate table.
- Add the table to a page.
- Save the file.
The following code snippets show how to add table in an existing PDF file.
AutoFitToWindow property in ColumnAdjustmentType enumeration
Hide Spanned Cell Borders
While adding cells to a table, the spanned cell borders may show up when they break to another row. Such spanned borders can be made hidden as shown in the following code sample.