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 |
Array item records
Every Items entry of a ctOperandArray token is a THPDFArrayItem:
THPDFArrayItem = record
IsString: boolean;
IsHex: boolean;
StrBytes: AnsiString;
NumValue: Double;
StartOfs: Integer;
EndOfs: Integer;
end;
IsString and IsHex describe the operand form, StrBytes carries the raw string bytes, and NumValue carries the TJ kerning adjustment of a numeric item
StartOfs and EndOfs span the whole literal in the source stream, parentheses or angle brackets included, so a text replacement can rewrite the operand in place
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