PDFiumPas Docs

TryGetContentEvent method

Component: TPdf · Unit: PDFium

Added in internal v3.404.0, updated 2026-11-10

Syntax

function TryGetContentEvent(Index: Integer;
  out Info: TPdfContentEventInfo): Boolean; overload;
function TryGetContentEvent(const ContainerPath: TPdfCharacterSourcePath;
  Index: Integer; out Info: TPdfContentEventInfo): Boolean; overload;

Reads one zero-based source event from the current page or a Form invocation and checks kinds, bounds, scope depths, matching declarations and parent closure

Paths use the same container selection as ContentEventCount; the returned path is copied rather than aliased

FieldMeaning
KindcekBMC, cekBDC, cekEMC, cekMP or cekDP; cekUnknown is the cleared failure value
ObjectBoundaryNumber of native objects preceding the operator in this container; empty declarations and points need no paint object
StreamIndexOriginal zero-based content-stream slot in this container
ParserOffsetExclusive native parser position in the concatenated source, including parser separators; not a raw file cut point
ParentIndex / MatchingIndexSource event indexes, or minus one when absent; opener and closer share one exact mark handle
DepthScope depth before this operator
MarkBorrowed native declaration or point handle; parameter values remain live native objects
ContainerPathCopied Form invocation path, empty for a page

False clears Kind to cekUnknown, boundary/stream/parent/matching to minus one, offset/depth to zero, the handle to null and the path to empty

Discard records after any mutation, generation, close or reload; repeated Form invocations have independent declaration identities

Preserving edits

Internal v3.407.0 adds logical edit views and transaction-bound cursors for InsertContentEvent and RemoveContentEvent; use fresh cursors after structural mutations, and retain original parser coordinates only as an expiring source snapshot

Internal v3.406.0 adds SetContentEventTag, SetContentEventParam and RemoveContentEventParam for source-only declarations and points; all require an active preserving transaction

Use BeginPageObjectEditTransaction(False, True) to request source-event preservation for a batch of typed object edits, then commit once

Internal v3.405.0 extends preserving regeneration from text to paths, named image XObjects and Form invocation geometry; empty/gapped stream declarations, points and exact membership survive supported edits and removal, and supported canonical output can be reopened and edited again

Dirty untagged Form subtrees receive private streams and resource namespaces per invocation, including nested edits and removal; unchanged invocations retain their original streams, dictionaries and resources

Form Matrix and BBox entries retain their meaning; changing a Form invocation's inherited graphics after parsing is rejected because its cached children would otherwise use stale state

Insertion, changed declaration membership, inline images, source clipping, non-Normal blend states, default RGB/Gray overrides, unknown graphics-state keys and lossy native operands remain outside that writer profile; a Form's unchanged implicit BBox clip is supported

Dirty Forms with StructParents or documents with StructTreeRoot are rejected until reciprocal structure updates are supported; unchanged tagged Form streams can remain opaque

The writer accepts at most 4096 original content-stream slots; a readable inventory alone does not certify that the current source/edit combination can be regenerated

Recursive preflight limits depth to 64 and the represented tree to 1048576 objects and 1048576 events; it completes before any stream or namespace mutation

A rejected preserving commit restores the transaction snapshot and raises EPdfError; it never falls back to ordinary generation

Marked-content preservation does not establish tagged ParentTree reciprocity or PDF/A/PDF/UA conformance

See also

ContentEventCount, BeginPageObjectEditTransaction, CommitPageObjectEditTransaction