THPDFContentToken Record
Represents a single content-stream token, operator or operand, together with its source byte span and inline image payload
Declaration
THPDFContentToken= record
Kind: THPDFContentTokenKind;
Op: AnsiString; // operator text (ctOperator) or name literal
StrBytes: AnsiString; // raw bytes of string/hex operand
IsHex: boolean;
NumValue: Double; // numeric operand
Items: THPDFArrayItems; // ctOperandArray payload
// StartOfs/EndOfs are byte offsets into the source content stream spanning
// the operand as written. For a string/hex operand this covers the full
// literal including its '(' ')' or '<' '>' delimiters; operators and
// other operands record their span too. Search/replace uses these to map
// a matched glyph back to the bytes that produced it
StartOfs: Integer;
EndOfs: Integer;
// Inline image payload (only the 'BI' operator token carries these;
// every other token leaves them at their default zeros). InlineBytes is
// the raw image data between ID and EI; InlineKeys is the normalised
// BI key/value set. Both default to empty when not an inline image
InlineBytes: SysUtils.TBytes;
InlineKeys: THPDFInlineImgKeys;
end;
Unit
HPDFContentStream
Fields
| Field | Purpose |
|---|---|
Kind | Token class: ctOperator, ctOperandString, ctOperandHex, ctOperandName, ctOperandNumber, or ctOperandArray |
Op | Operator text for ctOperator tokens, or the name literal for name operands |
StrBytes | Raw bytes of a string or hex operand, delimiters included in the source span |
IsHex | True when the string operand was written as a hex string |
NumValue | Numeric operand value, including TJ kerning adjustments |
Items | Array payload for ctOperandArray tokens |
StartOfs | Byte offset of the token as it is written in the source content stream |
EndOfs | Byte offset immediately after the token |
InlineBytes | Raw image data between ID and EI; only the BI operator token carries it |
InlineKeys | Normalised BI key/value set; empty for every token other than BI |
Usage notes
- Tokens are the working unit of
THPDFPageDisplayList, the interpreter devices and the operator visitors StartOfsandEndOfsmap a matched glyph back to the exact operand bytes for search-and-replace- Only the
BIoperator token carries inline image data; every other token leavesInlineBytesandInlineKeysempty