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
| TextBlockListID | Handle returned by DAExtractPageTextBlocks |
|---|---|
| Index | 1-based text block index |
| CharIndex | 1-based UTF-16 code-unit position inside the block text |
| ContentLayer | 1-based page /Contents layer, or 0 for nested content |
| StreamObjectNumber | Object number of the containing stream, or 0 for a direct stream |
| StreamGeneration | Generation number of the containing stream |
| InstructionIndex | 0-based instruction index in the decoded content program |
| OperandIndex | 0-based text-string operand index |
| ArrayElementIndex | 0-based TJ array element, or -1 for a direct string operand |
| SourceByteOffset | 0-based offset in the decoded string value, or -1 when no safely addressable range exists |
| SourceByteLength | Number of encoded source bytes for the source glyph, or 0 when no safely addressable range exists |
| Flags | Bitwise content-location flags shared with GetTextBlockCharContentLocation |
Return values
| 1 | A location record was returned, including synthetic or read-only records |
|---|---|
| 0 | The 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