EnumPageContentStates

Page manipulation

Description

Traces every instruction in all content layers of the selected page and reports the effective graphics state in content order

The same tracker continues across the page /Contents array, so a q in one stream and its matching Q in a later stream preserve the correct stack state

Syntax

Delphi

Function EnumPageContentStates(AfterInstruction: Boolean; Out States: Array Of TPDFlibContentGraphicsState): Integer;

Parameters

AfterInstruction selects snapshots immediately after each operator when true and immediately before each operator when false

States receives as many records as fit in the caller-supplied array

Return value

The total instruction count, including records that do not fit in States, or zero when no document is selected or a layer cannot be parsed

Remarks

Call once with an empty array to obtain the count, allocate the destination, then call again to fill it

Page ExtGState, font and XObject resources are resolved once before tracing; XObject Do snapshots identify image, form or PostScript resources and report transformed invocation bounds

Text-showing operators advance TextMatrix with simple or composite font metrics, including horizontal or vertical writing, spacing, scaling and TJ adjustments

The initial clipping boundary uses the selected page CropBox, with the standard MediaBox fallback, and subsequent path operators update conservative or exact clipping bounds

Unresolved external resources retain their identifiers without inventing effective values

This API intentionally remains page-level only; use EnumPageContentStatesEx when Form XObject instructions shall be included