AnnotationsApi.flatten()
Burns annotations into page content as they show on screen (Acrobat's default), dropping hidden ones. Omit the index for the whole document. Not reversible. Flattening on export keeps the page as it prints instead: what is marked not to print is dropped. Flattening a signed document changes what the signature covers, so it would no longer verify: refused as Acrobat refuses. Needs the
annotations feature, and forms too where a form field's widget is flattened.methodAnnotationssince 1.0.0
Signature
flatten(pageIndex?: number, options?: SignedDocumentOptions): Promise<void>
Parameters
| Parameter | Type | Description |
|---|---|---|
| pageIndex? | number | Zero-based page index. Omit for the whole document. |
| options? | SignedDocumentOptions | { invalidateSignatures? }. |
Returns
Promise<void>
Throws
INVALID_ARGUMENT— a page index out of range.FEATURE_NOT_LICENSED— the license lacksannotations(orforms, when a page to flatten carries form fields).INVALID_STATE— a signed document, unlessoptions.invalidateSignatures; or a progressive document still downloading.PAGE_ERROR— a page could not be flattened.DOCUMENT_CLOSED— the document has been closed.
Example
TypeScript
await doc.annotations.flatten(); // the whole document