PDFium Delphi Component Docs

ExtractDocumentTables method

Component: TPdf  ·  Unit: PDFium
Extracts tables across every page and marks matching cross-page continuations

Syntax

function ExtractDocumentTables(
  const Options: TPdfTableExtractionOptions): TPdfTables;

Description

The method visits pages in document order, applies ExtractTables, shares the configured cell and table budgets across the complete scan, and restores the page that was active before the call

When DetectContinuations is enabled, two tables on consecutive pages form a chain when every column boundary matches within tolerance and either both fragments sit inside ContinuationMargin of their page edges or no other text lies below the first fragment and above the second one; running headers and footers inside the margin are ignored. A fragment whose first row is one cell spanning the full width carries a caption and always starts a new table

Ruled fragments with fewer rows than MinRows are kept during a document scan when they turn out to continue the grid from the previous page, so a single row that spilled over a page break is not lost

TPdfTableExtractionOptions controls the two strategies with DetectRuledTables and DetectWhitespaceTables, bounds acceptance with MinRows, MinColumns, and HeaderRowCount, and tunes geometry with the tolerance fields including ContinuationMargin for chain matching

Continuation values

Example

var
  Options: TPdfTableExtractionOptions;
  Tables: TPdfTables;
  I: Integer;
begin
  Options := TPdfTableExtractionOptions.Default;
  Tables := Pdf1.ExtractDocumentTables(Options);
  for I := 0 to High(Tables) do
    Memo1.Lines.Add(Tables[I].ToJson);
end;

See Also

ExtractTables, GetStructuredText