Class 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

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

Properties

NameDescription
virtual TableList { get; }Returns readonly IList containing tables that were found
virtual TextSearchOptions { get; set; }Gets or sets text search options.
UseFlowEngine { get; set; }* Enable an alternative table recognition engine that is superior in numerous scenarios and is capable of recognizing tables without borders. Doesn’t support editing tables and getting text styles yet. Default value is false;

Methods

NameDescription
Remove(AbsorbedTable)Removes an AbsorbedTable from the page.
Replace(Page, AbsorbedTable, Table)Replaces an AbsorbedTable with Table on the page.
Visit(Document)Extracts tables in the specified document.
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