THPDFHeadlessDocument.SaveToFile
Unit: HPDFHeadlessDocument
procedure SaveToFile(const FileName: string);
Save an independent incremental PDF by copying original bytes and appending dirty objects, a classic xref table, and a Prev-linked trailer
This is a serialization operation rather than a byte-identical source snapshot; even an unchanged object graph may receive an appended cross-reference revision while retaining the complete original prefix
Encrypted replacements use their destination object number and generation, including newly planned objects; streams already decrypted during loading are encrypted once under the selected output crypt filter
Authenticated modification policies also apply to ordinary saves; a loaded graph that violates an authenticated policy is not made publishable by saving without another edit
See encrypted incremental updates for supported handlers, metadata exceptions and object-stream behavior
Rejects aliases of the source path or file identity; an exclusive same-directory staging file is flushed and atomically renamed, preserving an existing destination on cancellation, limit, or serialization failure
Windows publication uses bounded, cancellable retries for transient access-denied, sharing and lock errors while retaining atomic replacement, permanent-failure diagnostics and staging cleanup
Windows atomic publication documents the eight-attempt limit and actual file-handle acceptance