THPDFHeadlessDocument.SaveAnnotationsXFDFToFile method
function SaveAnnotationsXFDFToFile(const FileName: string; const Bytes: SysUtils.TBytes; const XFDFOptions: THPDFHeadlessXFDFOptions): Integer;
Appends admitted XFDF annotations to the loaded document and atomically publishes an incremental PDF, returning the number of top-level annotations appended
The loaded document and any prior unsaved graph changes remain available without adopting the new revision; load the saved file explicitly to adopt it
Named targets, all eight explicit destination modes and local GoTo actions bind existing document pages through actual indirect references and preserve bounded exact decimal coordinates
Existing page annotations remain in order, new objects receive independent references, and nested popups and forward replies resolve before serialization
Duplicate names or ambiguous, absent or self-referencing reply targets fail the complete import; the method does not replace existing annotations
A changed revision must not overwrite an alias of the loaded source; an authorized unchanged empty import can retain the same path or hard-link target without rewriting its bytes, and failed preparation, output limits or cancellation preserve an existing destination file
Annotation permissions and authenticated certification policy apply; configure SetSignaturePolicyOptions when a signed source requires an application-specific trust policy
Standard stamp appearance transport preserves actual Form streams and bounded acyclic font, image and graphics resources through base64 typed XML
An authorized empty import returns zero and preserves exact source bytes when the current graph has no unsaved changes; unsaved graph changes are saved without being discarded, and authorization is still required before the no-op path
Options := THPDFHeadlessXFDFOptions.Default;
Updated := Document.SaveAnnotationsXFDFToFile('annotated.pdf', XFDFBytes, Options);