function CommitIncrementalSave(Stream: TStream; out Info: TPdfIncrementalCommitInfo): Boolean;
| Stream | Destination for the complete document, including the baseline and every revision appended so far; nil raises EPdfError |
| Info | TPdfIncrementalCommitInfo receives object and byte counts, prior and new xref offsets, revision count, encryption and validation state, and file durability results |
| Result | True when the complete validated output was written |
function CommitIncrementalSave(const FileName: string; out Info: TPdfIncrementalCommitInfo): Boolean;
| FileName | Destination file, replaced atomically through a durable side file in the same directory |
| Info | The same TPdfIncrementalCommitInfo report as the stream overload, with Durable and ReplacedAtomically set after those file stages succeed |
| Result | True when the validated side file replaced the destination |
Diffs the live document against the state captured at the last commit, or against the baseline for the first one, and appends the changed objects plus a fresh cross-reference section. Earlier bytes are never rewritten, so every previous revision stays byte-identical and recoverable
AppendedByteCount is the size of the new revision alone, whilst PreviousOutputByteCount and OutputByteCount delimit the immutable prefix and complete result. PreviousXrefOffset and OutputXrefOffset identify the revision chain, and ChangedObjectCount reports how many objects the diff found
Every candidate passes sparse revision-boundary checks, a strict independent reopen, page-count and security-handler checks, and PDF MAC validation when present. Encrypted and Validated report these properties
The file overload writes a side file beside the target, flushes it, closes and reopens it, and validates again before atomic replacement; Windows requests write-through replacement, whilst Unix checks directory-flush support first and flushes the parent directory after renaming
Failure before replacement preserves the target and restores the session baseline and revision count. If a Unix directory flush fails after a successful rename, the internal FPdfPlatform unit raises EPdfOutputCommitError: replacement has happened, Info.ReplacedAtomically=True and Info.Durable=False. The session keeps the committed baseline, preventing later edits from appending to obsolete output
Durable confirms that the platform's requested flush stages completed; it does not certify hardware or filesystem behaviour after power loss. Other save APIs sharing atomic replacement can likewise raise this exception after commitment, so distinguish it from failures that retain the previous output
Calling without an open session raises EPdfError, so BeginIncrementalSave must come first