Native annotation removal

Remove existing page annotations by their zero-based page index and exact Unicode NM value, whilst retaining the original PDF revision and preparing a separate incremental output

The native entry point is THPDFHeadlessDocument.SaveAnnotationRemovalsToFile; ordinary Windows documents use THPDFWindowsFormDataTransaction.RemoveAnnotations

Identity and dependencies

Each identity contains a valid page index and a nonempty name; matching is case-sensitive after decoding the PDF text string, without Unicode normalization or a match against display text

The same name on different pages identifies different annotations; an absent name on the selected page is a no-op

Removing an annotation also removes its popup and replies that depend on it, including nested replies and popup dependencies; a visited set makes dependency cycles finite, and each removed annotation contributes once to the returned count

Removing a popup alone retains its owner and clears the owner's Popup entry; unrelated annotations retain their original order and data

Duplicate requested identities, an ambiguous requested name on one page, or an annotation dictionary shared by multiple page-array entries cause failure before publication

Publication and safety

The native method leaves the loaded document unchanged on success and failure; load the resulting PDF to adopt the removal

Publication uses a prepared file and atomic destination replacement; a failed or cancelled preparation preserves the existing destination, and the destination must not alias the loaded source

Zero removals publish an exact copy of the current source revision; repeating the same removal against the resulting document returns zero and retains its bytes

An incremental revision removes annotations from the current page graph whilst retaining older bytes and revisions; this operation is not secure erasure or redaction, and deleted content can remain recoverable from the file history

Permissions and resource limits

Actual removals require authenticated annotation permission for encrypted input and signature-policy admission for signed input; successfully opening an encrypted PDF does not by itself grant permission to change annotations

Authenticated certification P1 and P2 reject annotation changes; a permitted P3 update preserves the original signed bytes, with signature integrity and certificate-binding checks applied to the actual document

Configure required certificate trust, timestamps and revocation policy explicitly when those checks are part of the application's security requirements

Removal options bound annotation count, operation work, name storage and working memory, with cooperative cancellation shared with the document or transaction

Current boundary

A selected Widget, or a Widget reached through removal dependencies, is rejected because removing form fields requires an AcroForm field-tree transaction; this API does not delete fields or silently detach their widgets

The operation does not execute annotation actions or scripts and does not interpret removal as applying a Redact annotation

See JSON and callback operations for annotations.remove, explicit input IO and the separate PDF, result and context commit stages