Native AcroForm field-tree removal

Remove AcroForm fields by their exact, decoded Unicode names with THPDFHeadlessDocument.SaveFormFieldRemovalsToFile, or use forms.remove through a JSON operation entry point

Selection and ownership

A complete field name consists of its named ancestors separated by periods; matching is case-sensitive and does not interpret wildcards, prefixes or numeric indices

Selecting a parent removes its complete subtree, including terminal fields and their Widgets; overlapping parent and child selectors remove each terminal field once

The transaction removes selected Widgets from their page annotation arrays, updates surviving Kids, filters the AcroForm Fields and CO arrays, and removes ancestors left without child fields

Named fields without visible Widgets and valid off-page Widgets participate in the same transaction

The result counts removed terminal fields, including terminal fields selected through an ancestor; it does not count structural ancestors or Widgets separately

Empty requests and valid unmatched names return zero and publish an exact copy of the current source; empty names, NUL characters, duplicate selectors, ambiguous selected names and malformed ownership fail

The complete tree must have consistent Parent/Kids relationships and unique Widget ownership; a page Widget's optional P must identify its actual page

Publication and policy

Native file output is prepared privately and published atomically; the loaded document remains unchanged, so reload the output to adopt the resulting revision

A changed result is an incremental revision that preserves the original file prefix; removal does not securely erase field data retained in earlier revisions

Read-only terminal fields and signed signature fields cannot be removed; authenticated DocMDP certification rejects field-tree structure changes

Authenticated FieldMDP and signature field locks continue to protect their selected fields; an authenticated FieldMDP Catalog anchor does not itself lock every field reachable from the Catalog

Encrypted input requires the applicable structure permissions, or owner authentication; successful password authentication alone does not establish permission to change the field tree

Trust, timestamp and CAdES requirements use the document's existing signature-policy options

Limits and diagnostics

THPDFHeadlessAnnotationRemovalOptions supplies Widget, operation, name-byte and working-byte capacities and an optional shared cancellation token; the document's field, object and depth limits also apply

Name storage includes selectors and complete names encountered while validating the ownership tree; a short request can therefore require more name capacity than its own text length

Malformed ownership and invalid names report hdInvalidDocument; exhausted capacities report hdLimitExceeded; read-only selection reports hdReadOnlyField

XFA field-tree removal requires an XFA dataset transaction and reports hdFieldTypeUnsupported through this AcroForm entry point

See page annotation removal for selectors based on page and annotation NM, and the Windows prepared transaction