THPDFSemanticTextLayout Record

Resultado da análise de ordem de leitura semântica sobre glyphs posicionados da página

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

A unit é HPDFContentStream; Lines guarda as linhas de ordem de leitura detectadas com metadados de cell, zone, table, list-level e source-order

Records de linha

Cada elemento de Lines é um 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 é o texto da linha, Cells guarda as células de tabela opcionais dela, e Kind classifica a linha por papel de bloco

Left, Bottom, Right e Top são a caixa da linha em espaço do usuário; BaselineY é a linha de base e FontSize o tamanho de fonte dominante

ColumnIndex e ZoneIndex identificam a coluna de leitura e a zona, enquanto TableIndex, TableRowIndex, ListLevel e SourceOrder localizam a linha dentro de uma tabela, de uma lista e da ordem original dos glyphs

Records de célula

Cada elemento de Cells é um THPDFSemanticTextCell:

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

Text é o texto da célula e os quatro campos de caixa descrevem a célula em espaço do usuário; FirstGlyphIndex e LastGlyphIndex são índices inclusivos no array de glyphs da página

Tipos de bloco

THPDFSemanticBlockKind classifica THPDFSemanticTextLine.Kind com sbkParagraph, sbkHeading, sbkListItem, sbkTableRow e sbkCaption

ColumnCount e TableCount resumem a estrutura detectada, enquanto as duas medianas caracterizam o advance típico de glyph e o tamanho de fonte em pontos do espaço de usuário

O registro é preenchido por HPDFAnalyzeSemanticTextLayout e exposto por página por THPDFHeadlessDocument.AnalyzePageSemanticText e os equivalentes de documentos carregados

AnalyzePageSemanticText