PDFiumPas Docs

RebindContentEvent method

Component: TPdf · Unit: PDFium

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

Syntax

procedure RebindContentEvent(const Cursor: TPdfContentEventCursor;
  StructureNodeID, MarkedContentID: Integer; MaxWork: LongWord = 1048576);

Move one existing page-scoped MCID declaration to an explicitly reviewed structure element and optionally renumber it, updating the physical BDC, the element's K items and ParentTree together

Arguments

Cursor must be a fresh transaction-bound page cursor immediately before the selected BDC, with its exact event index, ObjectBoundary and StreamIndex; a Form ContainerPath is rejected

StructureNodeID is the positive indirect object number of an existing reachable structure element in this document, as exposed by ReadPdfDocumentStructure; it is not an index in StructureElements or a native structure-tree child array

Obtain and review the target from the same current document snapshot; object numbers from an unrelated or rewritten document do not identify a reviewed semantic owner

MarkedContentID is in 0..65535; keeping the current value retains the MCID number whilst changing its reviewed owner and role tag, whilst changing it clears the old ParentTree slot and fills the new one

MaxWork is a native planning budget in 1..1048576 units; retained live event metadata has a separate 16 MiB limit

Ownership and preservation

The selected physical MCID must have one declaration and one reciprocal structure owner; conflicting declarations, claims, namespaces or ParentTree slots reject before mutation

The target element's existing raw S name becomes the BDC tag; the element's own role and RoleMap remain unchanged, and the caller remains responsible for semantic correctness

Moving to another owner appends the MCR to that element's K items; renumbering within the same owner retains its existing position, and other child/content-item order remains unchanged

Moving an integer K item materialises an MCR with explicit Pg, so the target element's inherited page cannot redirect the binding

Existing explicit Stm and StmOwn associations follow preserving dirty saves; owner-local K/MCR shells and the affected number-tree path isolate shared templates and unselected page namespaces

Paint objects, exact native mark/member identities, ActualText strings and PdfParagraphClusterMap bytes are retained; paint text and geometry do not change, whilst structured reading follows the reviewed owner and its existing semantics

Accepted rebinding advances the ledger revision once, expires older cursors and invalidates structure/readable caches and the current text page; obtain fresh event views and cursors before another structural operation

Transaction and availability

Requires BeginPageObjectEditTransaction with PreserveSourceEvents=True and the optional FPDFPage_RebindContentEvent procedure included in the internal v3.410.0 bundled modules

Older DLLs load normally; the method raises EPdfError when the optional procedure is absent, leaving the unchanged batch available for supported operations

Caller validation or native preflight rejection leaves the batch and any earlier accepted edits intact; no ordinary-generation fallback is used

After native acceptance, failure during cache invalidation, text-page closure or a later preserving generation closes the batch and restores its entire captured snapshot, including earlier edits

Forms, new MCID declaration creation, arbitrary object insertion/movement and complete tagged-document or PDF/UA conformance remain outside this operation

See also

BeginPageObjectEditTransaction, TryCreateContentEventCursor, TryGetContentEventForEdit, FPdfDocumentStructure, SetContentEventTag