OutlineApi.set()
Replace the whole tree. Keeps only titles, pages and nesting: each bookmark's zoom, color, style, other actions and open state are lost — use
add, delete and setTitle for single edits, which change one bookmark and nothing else. Needs the edit-pages feature.methodEditingsince 1.0.0
Signature
set(nodes: OutlineNode[], options?: SignedDocumentOptions): Promise<void>
Parameters
| Parameter | Type | Description |
|---|---|---|
| nodes | OutlineNode[] | The whole tree: { title, pageIndex, children } each. |
| options? | SignedDocumentOptions | { invalidateSignatures? }. |
Returns
Promise<void>
Throws
FEATURE_NOT_LICENSED— the license lacksedit-pages.PAGE_ERROR— the change could not be written.DOCUMENT_CLOSED— the document has been closed.INVALID_STATE— a certified document, unlessoptions.invalidateSignatures(no certification level allows bookmark changes); or a progressive document still downloading.
Example
TypeScript
await doc.outline.set([ { title: 'Cover', pageIndex: 0, children: [] }, { title: 'Terms', pageIndex: 4, children: [{ title: 'Payment', pageIndex: 5, children: [] }] }, ]);