PDFiumPas Docs

SetContentEventParam method

Component: TPdf · Unit: PDFium

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

Syntax

procedure SetContentEventParam(Index: Integer;
  const Param: TPdfContentMarkParam); overload;
procedure SetContentEventParam(const ContainerPath: TPdfCharacterSourcePath;
  Index: Integer; const Param: TPdfContentMarkParam); overload;

Sets a typed parameter on one declaration or marked point, isolating its dictionary from other users of a shared Properties resource

TPdfContentMarkParam accepts pmpInt, pmpFloat, pmpString and pmpBlob; unknown kinds, non-finite floats and MCID changes are rejected

Parameter keys must be nonempty UTF-8 PDF names without null characters and fit within 255 bytes

pmpString encodes Unicode as a PDF text string; the UTF-8 input and encoded PDF bytes each have a 32767-byte limit, and invalid Unicode is rejected

pmpBlob preserves the supplied bytes exactly, including nulls, with a 32767-byte limit

Adding parameters promotes BMC or MP to BDC or DP; unrelated dictionary keys and original resource aliases remain intact

The native live graph is checked against the 16 MiB scalar/key/tag, 262144 direct node/entry and depth-32 limits before committing the edit

Reading text parameters

After reload, obtain a fresh mark through TryGetContentEvent and use the optional FPDFPageObjMark_GetParamTextValue to decode PDFDocEncoding or Unicode PDF text to UTF-16LE

The new reader uses the same buffer-size and output-length convention as GetParamStringValue; check Assigned before calling it on an external runtime

GetParamStringValue keeps its legacy raw UTF-8 interpretation and is unsuitable for arbitrary encoded PDF text; GetParamBlobValue returns the original bytes

ActualText and coordinate tables

Adding, replacing or removing ActualText on a represented scope first plans invalidation of PdfParagraphClusterMap tables on the surviving declaration, affected shared members and affected Form descendants

The plan conservatively clears descendant tables even when an inner paragraph has its own ActualText; it retains the ActualText strings, paint content, unrelated invocations and unselected nested branches

First-glyph PCM1 columns stay within their sibling container; horizontal multi-glyph maps are distinguished when native raw glyph counts are available; the scan shares a 1048576-unit work budget and total Form depth 64

Invalidating the changed declaration's own table is required even when the declaration survives or gains its first ActualText parameter; the complete metadata edit and invalidation join one transaction

MCID changes remain rejected; nonstructural tagged-page metadata can retain an existing ParentTree/MCID binding without changing the structure tree

Transaction and ownership

Available in internal v3.406.0 through the optional native source-event extension

Call only inside BeginPageObjectEditTransaction(False, True); an ordinary or inactive batch raises EPdfError before mutation

An empty path selects the current page; a nonempty path selects one Form invocation using zero-based page-object and Form-child indexes, with at most 64 path entries

Event indexes refer to the current parsed container; use the opener of a declaration or a marked point, not its closing EMC

Internal v3.409.0 also edits scopes with represented paint members through the optional FPDFPage_SetContentEventMemberValue or FPDFFormObj_SetContentEventMemberValue procedure, retaining exact shared mark identity and member lists

Older runtimes keep their source-only profile: the wrapper falls back to the original setter, which rejects represented declarations whilst still supporting empty scopes and marked points

Successful requests join the deferred batch and commit generates once, including when only a zero-paint Form changed; independent shared invocations retain their original streams and resources

Actual changes expire public parser coordinates; current logical event indexes remain usable for metadata edits; after a structural splice or object removal, obtain fresh indexes from TryGetContentEventForEdit

Invalid paths, encodings, limits or unavailable optional procedures raise EPdfError without applying that request; the active transaction remains available for explicit rollback

If post-edit paragraph invalidation or a later preserving commit fails, it closes the batch, restores the entire captured snapshot including earlier edits, and raises EPdfError without ordinary-generation fallback

The complete source/edit combination must fit the preserving writer profile; dirty Forms carrying StructParents, or in a document with StructTreeRoot, remain rejected until reciprocal structure updates are supported

Native runtimes without the extension remain usable for their existing supported operations

Explicit page-stream structure references

Internal v3.409.1 preserves explicit MCR/Stm links through page-stream regeneration, including scalar or array Contents, continued scopes across empty stream slots, indirect MCR dictionaries and inherited Pg context

Structural back-references alone do not force content-stream cloning; genuine painting shared by another page is isolated, and only the selected page's MCR declarations are retargeted

ParentTree slots, MCIDs, StmOwn and opaque declaration values remain intact; shared MCR templates and K arrays are detached only for the affected owner

The relevant binding plan rejects unresolved page/stream references, conflicting ParentTree ownership, duplicate physical declarations, cyclic paths or exceeded depth/work bounds before any writes; this is a preservation check, not a full document-conformance audit

Tagged Form cloning, role/MCID reassignment and broader source/graphics profiles remain separate requirements

Internal v3.410.0 adds the separate RebindContentEvent method for a reviewed page-scoped MCID owner or number change; it retains the target element role, requires a fresh page cursor and restores the whole batch after post-acceptance failure

See also

TryGetContentEvent, ContentEventCount, BeginPageObjectEditTransaction, SetContentEventTag, RemoveContentEventParam