Web SDKv1.0.0

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

ParameterTypeDescription
titlestringThe bookmark's title.
pageIndexnumberThe zero-based page it goes to.
options?AddBookmarkOptionsparentPath (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 a parentPath that names no bookmark.
  • FEATURE_NOT_LICENSED — the license lacks edit-pages.
  • PAGE_ERROR — the change could not be written.
  • DOCUMENT_CLOSED — the document has been closed.
  • INVALID_STATE — a certified document, unless options.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 });

More in OutlineApi