PDFiumPas Docs

InsertContentEvent method

Component: TPdf · Unit: PDFium

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

Syntax

function InsertContentEvent(const First: TPdfContentEventCursor;
  Kind: TPdfContentEventKind; const Tag: WString): Integer; overload;
function InsertContentEvent(const First, Last: TPdfContentEventCursor;
  Kind: TPdfContentEventKind; const Tag: WString): Integer; overload;

The single-cursor overload inserts cekMP or cekDP; the two-cursor overload inserts a matched cekBMC or cekBDC scope and requires both cursors to identify the same container path

Returns the new point or opener index; Tag must be valid Unicode, nonempty, free of null characters and at most 255 UTF-8 bytes; BDC and DP start with an empty direct parameter dictionary

Native paint objects remain in place; a new scope rebuilds affected member mark lists whilst retaining every surviving exact mark identity and nested declaration; crossing ranges, existing membership disagreement and tagged member changes reject before mutation

Plain wrappers leave paragraph tables intact; these APIs do not provide arbitrary native-object insertion or movement, reciprocal structure-tree editing or general represented-member parameter editing

Transaction and availability

An empty ContainerPath selects the current page; a nonempty path selects a private Form invocation using a page-object index followed by Form child indexes, all zero-based, with depth at most 64

These optional native procedures are included in the internal v3.407.0 bundled modules; external older DLLs still load, queries return False and mutation attempts reject when the required extension is absent

Failed state reads clear Revision to zero and counts to minus one; failed event reads clear handles and paths, use cekUnknown and set boundary, stream, parent and match to minus one; failed cursor creation clears ownership and sets boundary, event and stream to minus one

Logical availability does not promise that every graphics style can be regenerated; mutations join one deferred preserving transaction, and a failed commit restores its snapshot without falling back to ordinary generation

The bounded profile allows 64 open scopes, 16 MiB of captured scalar/key/tag bytes, 262144 direct node/entry visits and parameter-tree depth 32; paragraph metadata scans have a separate 1048576-unit work budget

See also

TryGetContentEvent, BeginPageObjectEditTransaction, TryGetContentEventEditState, TryGetContentEventForEdit, TryCreateContentEventCursor, RemoveContentEvent