TPDFContentStateTracker
Content stream editing
Description
Applies parsed content instructions to one persistent effective graphics state and a complete q/Q stackReuse one tracker across consecutive
TPDFContentProgram instances when a page stores its logical content sequence in several streams
Syntax
Delphi
TPDFContentStateTracker = Class Procedure Reset; Procedure ClearExtGStates; Procedure ClearXObjects; Procedure ClearFonts; Procedure ClearProperties; Function RegisterExtGState(Const ResourceName: AnsiString; Dictionary: TPDFDictionary): Boolean; Function RegisterXObject(Const ResourceName: AnsiString; XObjectStream: TPDFStream; ObjectNumber: Integer = 0): Boolean; Function RegisterFont(Const ResourceName: AnsiString; FontObject: TPDFObject; ResourceScope: Integer): Boolean; Function RegisterProperty(Const ResourceName: AnsiString; PropertyObject: TPDFObject): Boolean; Procedure BeginContentStream; Procedure SetContentLocation(Layer, ContentDepth, ContentInvocationID: Integer); Procedure InitializeForm(Const ParentState: TPDFContentGraphicsState; Const FormMatrix: TPDFContentMatrix; MatrixKnown: Boolean; BBoxLeft, BBoxBottom, BBoxRight, BBoxTop: Double); Procedure SetInitialClipBounds(Left, Bottom, Right, Top: Double); Procedure Apply(Inst: TPDFContentInstruction); Function Snapshot: TPDFContentGraphicsState; Property StackDepth: Integer; Property RestoreUnderflowCount: Integer; Property MarkedContentUnderflowCount: Integer; Property ResourceScope: Integer; Property OnMeasureText: TPDFContentMeasureTextEvent; End;Remarks
RegisterExtGStategs
RegisterXObjectDo/BBox
RegisterFont
RegisterProperty/Properties/MCIDClearProperties
BeginContentStreamBDCEMCSetContentLocation
InitializeForm/BBox
q/Q
SetInitialClipBoundsWW*q/Q
OnMeasureText validates and precompiles one external graphics-state dictionary so repeated Tj operators do not rescan the PDF resource treeTJ precompiles Image, Form and PostScript stream metadata so repeated ' operators resolve in constant-time name lookups; Form bounds use the form matrix, active CTM and all four " corners
RestoreUnderflowCount binds a resource name to its indirect object and resource scope so identical names in nested content do not collideQ precompiles one named property-list dictionary from the page's MarkedContentUnderflowCount resources, capturing its entries and optional EMC, so marked-content operators that reference the property by name resolve in constant-time lookups;
Reset drops all registered property dictionaries