PDFium Delphi Component Docs

CommitPageObjectEditTransaction method

Component: TPdf  ·  Unit: PDFium
Applies the journalled edits of an open page-object edit transaction

Syntax

function CommitPageObjectEditTransaction: Boolean;

Description

CommitPageObjectEditTransaction finalizes the page-object edits of the transaction opened with BeginPageObjectEditTransaction, regenerates page content when dirty, and closes the transaction

It returns True when edits modified the page and were committed, or False when the transaction contained no dirty edits; if content generation fails, it automatically restores the captured snapshot and raises EPdfError

Remarks

Example

if Pdf1.CommitPageObjectEditTransaction then
  Memo1.Lines.Add('Transaction committed');

Source-event preserving batches

Pass PreserveSourceEvents=True as the second argument of BeginPageObjectEditTransaction to request the native preserving profile; internal v3.405.0 supports text, paths, named images, Form invocation geometry and private dirty untagged Form subtrees

A dirty preserving commit generates once; unsupported source/edit combinations or a missing extension restore the snapshot and raise EPdfError, with no ordinary-generation fallback

A transaction with no mutations returns False without generating or certifying source compatibility

Commit failure already closes and restores the transaction; call explicit rollback in an exception handler only while PageObjectEditTransactionStatus.Active remains True

Reviewed Form generation since internal v3.412.0

When the optional native review query requests it, commit retains its original local baseline even after closing the active transaction state, reviews that baseline and a fresh serialized native-document snapshot, and passes only matching stream number/generation identities that are exclusive on the current page in both reviews

Every page and every annotation N/R/D appearance state is counted; soft-mask, Pattern, Type3 and external/reference Form uses are conservatively excluded, including appearances introduced after the transaction began and direct annotation dictionaries emitted by PDFium

Exclusive internally tagged or whole-object OBJR Form streams retain their original structured identity; unbound shared calls retain private cloning, while valid shared whole-object OBJR instance edits still require a separate reviewed semantic split

Each source review uses the documented Form usage reader limits, including a 128 MiB source cap, and at most 65536 matching source identities are passed to native planning with 1048576 work units; native-process isolation remains a separate requirement

A missing required Form procedure, unavailable review, source refusal or generation failure restores the complete original batch, including earlier page edits and late annotation changes; ordinary generation is never substituted

Internal v3.413.0 includes the reviewed Form procedures in all four bundled Windows DLLs; the exact Win64 ordinary module retains its original qualification, while other variants have build/static evidence only and older runtimes retain the existing preserving page path and tagged Form refusal contract

Pattern source profiles since internal v3.415.0

The bundled Windows runtime supports qualified colored fill/stroke and shading Patterns, uncolored RGB/CMYK/Lab base components, retained Pattern/ColorSpace definitions and Form anchors during preserving generation; the public transaction signature and optional extension dispatch stay unchanged

Original resource definitions retain identity, while writable name maps are private; an inherited Pattern anchor can require a matrix-compensated private definition rather than mutation of a shared Matrix

Focused Win64 ordinary-runtime qualification at internal v3.415.1 also covers Pattern fill, stroke and combined text, text replacement, colored and uncolored stencil images, stencil movement and a shared stencil source through two saved generations; original Pattern/ColorSpace bindings, metadata, extracted text and independent pixels are checked. This extends the recorded scope of the unchanged v3.415.0 module without qualifying other module variants at runtime

Runtime evidence identifies each exact Win64 ordinary module; the other three bundled variants have build/static evidence only. Since internal v3.415.2, empty h and empty fill/stroke operators are accepted, including paint after n, zero-object pages and empty Form point edits; native object-count checks, invalid-operand and text-context refusals remain active. Nondefault blend/clip states, Type3 text regeneration, unsupported operators and uncertain ownership keep their existing refusals

Unreviewed Form edits keep the existing private invocation-clone policy, which may add a Form alias after reopen; stable Pattern/ColorSpace bindings do not imply general Form alias retirement. If required source-preserving generation is unavailable, the transaction restores the full batch

Since internal v3.415.3, the checked ownership generator also preserves reviewed ordinary Form streams, including ordinary ancestors of tagged content. A source shared with a resource-fallback consumer is first cloned; after reopening, a new review can prove that clone exclusive and retain its identity on later checked generations. A repeated source use cannot be claimed exclusive, and unreviewed generation retains private clones

Since internal v3.416.0, the optional native FPDFPage_ContentEventsHaveFormEdits query detects ordinary Form edits in preserving transactions. The wrapper reviews original and current snapshots before using the checked generator; page-only edits and older runtimes retain the existing path. An unavailable optional proof or an atomic checked preflight refusal keeps legacy preserving generation available; a write error or mandatory structured review failure restores the batch

See Also

BeginPageObjectEditTransaction, RollbackPageObjectEditTransaction, ExportEditJournal