SaveChanges

Document management

Description

Appends changed objects to the file originally opened by LoadFromFile, preserving every original byte and adding a new incremental xref section

The method validates Password before writing, rejects a source whose length changed externally, then reloads the updated file so another call uses the latest source length and /Prev chain

The selected public document handle and the current page remain stable across the reload

Reloading invalidates resource handles and transient results, including images, text blocks, page elements, fonts and active search results; enumerate or extract them again before continuing

Documents loaded from a stream or string have no original path and return zero

Syntax

Delphi

Function TPDFlib.SaveChanges(Const Password: WideString): Integer;

Parameters

PasswordThe password needed to reload an encrypted source, or an empty string for an unencrypted document

Return values

0The document is not file-backed, the password is wrong, the source changed externally or the append or reload failed
1The incremental update was appended and the updated document reloaded

See also

AppendToFile, AppendToStream, SaveToFile