PDFiumPas Docs

SetContentEventTag method

Component: TPdf · Unit: PDFium

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

Syntax

procedure SetContentEventTag(Index: Integer; const Tag: WString); overload;
procedure SetContentEventTag(const ContainerPath: TPdfCharacterSourcePath;
  Index: Integer; const Tag: WString); overload;

Renames one source declaration or marked point without creating a native paint object

The tag is encoded as UTF-8 and must be nonempty, contain no null character and fit within 255 bytes; PDF name escaping is applied during generation

Renaming a declaration carrying MCID is rejected until reciprocal structure updates are supported; assigning its existing tag can succeed as a no-op

Represented ownership

Renaming a represented declaration changes its shared native mark without splitting members or advancing the ledger revision; declarations using the same named Properties dictionary retain independent names

MCID-bearing role changes remain rejected; represented role changes in a document with StructTreeRoot or a Form with StructParents require reciprocal structure-tree updates and are rejected as well

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

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, SetContentEventParam, RemoveContentEventParam