THPDFHeadlessDocument.SaveFormFieldRemovalsToFile method
function SaveFormFieldRemovalsToFile(const FileName: string;
const FieldNames: array of UnicodeString;
const Options: THPDFHeadlessAnnotationRemovalOptions): Integer;
Prepares an AcroForm field-tree removal from the currently loaded source and atomically publishes a separate PDF to FileName
FieldNames contains exact, decoded Unicode complete names; selecting an ancestor includes all terminal fields and Widgets in its subtree
The return value counts removed terminal fields once, even for overlapping parent and child selection; structural ancestors and Widgets do not add to this count
An empty request or valid unmatched names return zero and publish the exact current source bytes; duplicate names, ambiguous selected names and malformed ownership fail
State and publication
The loaded document remains unchanged after success and failure; reload the published PDF to adopt a changed revision
A changed output retains the original file prefix and adds an incremental revision; the operation does not erase data in earlier revisions
The output path must not alias the loaded source; input, allocation, policy, budget and cancellation failures preserve an existing destination
Options and policy
Options supplies positive Widget, operation, name-byte and working-byte limits; the document's field, object and depth limits remain effective
An explicit cancellation token must match the document's shared token when both are configured
Read-only terminal fields, signed signature fields and authenticated DocMDP certification reject removal; authenticated FieldMDP and field-lock selections protect their covered fields
Encrypted input requires interactive field structure permission or owner authentication; signature trust and timestamp requirements follow the document's existing signature-policy configuration
See native field-tree removal, THPDFHeadlessAnnotationRemovalOptions and JSON and callback operations