TableAbsorber

TableAbsorber class

Represents an absorber object of table elements. Performs search and provides access to search results via TableList collection.

public class TableAbsorber

Constructors

Name Description
TableAbsorber() Initializes a new instance of the TableAbsorber.
TableAbsorber(TextSearchOptions) Initializes a new instance of the TableAbsorber with text search options.

Properties

Name Description
virtual TableList { get; } Returns readonly IList containing tables that were found
virtual TextSearchOptions { get; set; } Gets or sets text search options.
UseFlowEngine { get; set; } * Activate an early alfa version of alternative table recognition engine that could be used for conversion tables without borders. Doesn’t support editing tables and getting text styles yet. Default value is false;

Methods

Name Description
Remove(AbsorbedTable) Removes an AbsorbedTable from the page.
Replace(Page, AbsorbedTable, Table) Replaces an AbsorbedTable with Table on the page.
virtual Visit(Page) Extracts tables on the specified page

Examples

The example demonstrates how to find table on the first PDF document page and replace the text in a table cell.

// Open document
Document doc = new Document(@"D:\Tests\input.pdf");

// Create TableAbsorber object to find tables
TableAbsorber absorber = new TableAbsorber();

// Visit first page with absorber
absorber.Visit(pdfDocument.Pages[1]);

// Get access to first table on page, their first cell and text fragments in it
TextFragment fragment = absorber.TableList[0].RowList[0].CellList[0].TextFragments[1];

// Change text of the first text fragment in the cell
fragment.Text = "hi world";

// Save document
doc.Save(@"D:\Tests\output.pdf");  

See Also