THPDFHeadlessAnnotationRemovalOptions record

THPDFHeadlessAnnotationRemovalOptions = record
  MaxAnnotations, MaxOperations, MaxNameBytes: Integer;
  MaxWorkingBytes: Int64;
  CancellationToken: THPDFCancellationToken;
  class function Default: THPDFHeadlessAnnotationRemovalOptions; static;
end;

Declared in HPDFHeadlessDocument; initialise the record with Default before changing individual capacities

MemberDefaultScope
MaxAnnotations65536Bounds requested identities and the total page-annotation entries scanned across the document, including entries unrelated to the requested names
MaxOperations8000000Bounds actual traversal, reference resolution, identity processing, dictionary searches, sorting, dependency expansion and preparation work
MaxNameBytes16777216Bounds combined requested names and decoded annotation names, charged at two bytes per Unicode code unit
MaxWorkingBytes134217728Bounds removal preparation storage, detached structures and serialisation admission
CancellationTokennilOptional borrowed cooperative cancellation token

All numeric capacities must be positive; exceeding a valid capacity reports hdLimitExceeded through EHPDFHeadlessDocumentError

Document limits still apply, including file size, object size, decoded storage and reference depth; removal limits do not increase those capacities

If both the document and options provide a cancellation token, they must be the same instance; with no options token, the document's existing token remains effective

The Windows transaction supplies its own shared token and caps removal working memory at half of the transaction's working capacity and annotation count at its object capacity

JSON annotationLimits can lower the effective capacities; values above the surrounding operation's capacity are rejected rather than silently raising the budget

Failure and cancellation leave the native loaded graph and destination unchanged; see callback publication for output sinks that may already have received bytes