THPDFSemanticTextLayout Record

Result of semantic reading-order analysis over positioned page glyphs

THPDFSemanticTextLayout = record
  Lines: THPDFSemanticTextLines;
  ColumnCount: Integer;
  TableCount: Integer;
  MedianAdvance: Double;
  MedianFontSize: Double;
end;

The unit is HPDFContentStream; Lines holds the detected reading-order lines with cell, zone, table, list-level, and source-order metadata

Line records

Each element of Lines is a THPDFSemanticTextLine:

THPDFSemanticTextLine = record
  Text: UnicodeString;
  Cells: THPDFSemanticTextCells;
  Kind: THPDFSemanticBlockKind;
  Left, Bottom, Right, Top: Double;
  BaselineY: Double;
  FontSize: Double;
  ColumnIndex: Integer;
  ZoneIndex: Integer;
  TableIndex: Integer;
  TableRowIndex: Integer;
  ListLevel: Integer;
  SourceOrder: Integer;
end;

Text is the line text, Cells holds its optional table cells, and Kind classifies the line by block role

Left, Bottom, Right, and Top are the line box in user space; BaselineY is the baseline and FontSize the dominant font size

ColumnIndex and ZoneIndex identify the reading column and zone, while TableIndex, TableRowIndex, ListLevel, and SourceOrder locate the line inside a table, a list, and the original glyph order

Cell records

Each Cells element is a THPDFSemanticTextCell:

THPDFSemanticTextCell = record
  Text: UnicodeString;
  Left, Bottom, Right, Top: Double;
  FirstGlyphIndex, LastGlyphIndex: Integer;
end;

Text is the cell text and the four box fields describe the cell in user space; FirstGlyphIndex and LastGlyphIndex are inclusive indexes into the page glyph array

Block kinds

THPDFSemanticBlockKind classifies THPDFSemanticTextLine.Kind with sbkParagraph, sbkHeading, sbkListItem, sbkTableRow, and sbkCaption

ColumnCount and TableCount summarize the detected structure, while the two medians characterize typical glyph advance and font size in user-space points

The record is filled by HPDFAnalyzeSemanticTextLayout and surfaced per page by THPDFHeadlessDocument.AnalyzePageSemanticText and the loaded-document equivalents

AnalyzePageSemanticText