THotPDF.PrepareLoadedFormDataRevisionToStream

Prepares a private revision of the actual loaded graph without changing the original document

Declaration

procedure PrepareLoadedFormDataRevisionToStream(Destination: TStream;
  const Password: AnsiString; MaxWorkingBytes, MaxOutputBytes: Int64;
  MaxObjects: Integer; Checkpoint: TNotifyEvent = nil;
  OriginalSource: TStream = nil);

Behavior

The method copies the original revision to an exclusively created private file, loads a separate incremental document, compares semantic object graphs by object number and generation, clones actual pending changes, and writes the resulting candidate at the current destination position

Text values, existing appearances, unrelated pending catalog changes, indirect references, stream contents, and new graph objects participate in preparation; PDF names are decoded once and duplicate semantic dictionary names are invalid

An unchanged graph copies the exact original bytes without adding an empty incremental cross-reference section; changed graphs retain the complete original byte prefix and append their current revision

Encrypted revisions retain their original encryption dictionary and key; Password must authenticate the original revision and is supplied as UTF-8 bytes

OriginalSource, when supplied, must be the complete immutable original revision from which this document was loaded, including ciphertext and signed bytes; its position is restored on success and failure

Without OriginalSource, the method uses CopyLoadedSourceToStream; that does not turn an externally mutable borrowed source into an immutable snapshot, so callers must preserve its exact loaded bytes

MaxWorkingBytes must be at least 1 MiB; MaxOutputBytes and MaxObjects must be positive; source copying, object comparison, resident and spilled clone data, and output length have finite bounds

OperationCancellationToken and Checkpoint are polled during copying and comparison; copying uses blocks no larger than 64 KiB; a failed preparation can leave partial destination bytes, which the caller must discard

This low-level method prepares a graph revision and does not authorize pending changes under DocMDP or FieldMDP; use THPDFWindowsFormDataTransaction to authenticate signature policy before publishing form updates

The original THotPDF graph, source ownership, pending changes, and settings remain intact when preparation succeeds or fails; temporary files are closed and removed when the method exits

Related topics

CopyLoadedSourceToStream, THPDFWindowsFormDataTransaction, Windows FDF/XFDF exchange