OutlineApi.add()
Add one bookmark, as the last child of the bookmark at
options.parentPath (omitted: top level), going to pageIndex. Needs the edit-pages feature.methodEditingsince 1.0.0
Signature
add(title: string, pageIndex: number, options?: AddBookmarkOptions): Promise<number[]>
Parameters
| Parameter | Type | Description |
|---|---|---|
| title | string | The bookmark's title. |
| pageIndex | number | The zero-based page it goes to. |
| options? | AddBookmarkOptions | parentPath (a path into get()'s tree; omitted, top level) and invalidateSignatures. |
Returns
Promise<number[]> The new bookmark's path, for delete() / setTitle().
Throws
INVALID_ARGUMENT— a page index out of range, or aparentPaththat names no bookmark.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
const path = await doc.outline.add('Appendix', doc.pageCount - 1); await doc.outline.add('Tables', doc.pageCount - 1, { parentPath: path });