DAGetTextBlockCharContentLocation

Direct Access, Text, Extraction, Content streams, Diagnostics

Description

Returns the stable content-stream location and encoded source-byte range associated with one Direct Access extracted character

Syntax

Delphi

Function TPDFlib.DAGetTextBlockCharContentLocation(TextBlockListID, Index,
  CharIndex: Integer; Out ContentLayer, StreamObjectNumber,
  StreamGeneration, InstructionIndex, OperandIndex, ArrayElementIndex,
  SourceByteOffset, SourceByteLength, Flags: Integer): Integer;

Parameters

TextBlockListIDHandle returned by DAExtractPageTextBlocks
Index1-based text block index
CharIndex1-based UTF-16 code-unit position inside the block text
ContentLayer1-based page /Contents layer, or 0 for nested content
StreamObjectNumberObject number of the containing stream, or 0 for a direct stream
StreamGenerationGeneration number of the containing stream
InstructionIndex0-based instruction index in the decoded content program
OperandIndex0-based text-string operand index
ArrayElementIndex0-based TJ array element, or -1 for a direct string operand
SourceByteOffset0-based offset in the decoded string value, or -1 when no safely addressable range exists
SourceByteLengthNumber of encoded source bytes for the source glyph, or 0 when no safely addressable range exists
FlagsBitwise content-location flags shared with GetTextBlockCharContentLocation

Return values

1A location record was returned, including synthetic or read-only records
0The handle, block index or character index is invalid

Remarks

Direct Access locations are diagnostic and read-only because ReplaceTextBlockCharSourceBytes operates on a selected editable document

Offsets address decoded font-encoded string bytes rather than Unicode text

Location data remains available in the text block list after the Direct Access file handle is closed

Supplementary characters and ligature expansions may return the same source range for more than one UTF-16 position