Manage PDF bookmarks efficiently with Instant JSON
Types
This section explains how to use type declarations in Instant JSON records.
The optional keys are specified as follows:
{ optionalKey?: value; }
To save traffic, these keys shouldn’t be included in the record if the value is undefined.
Bookmarks
Bookmarks provide a way to mark [actions][]. Optionally, a bookmark can have a name, in which case clients will show the name of the bookmark.
The data is structured in the following way:
-
v
— The version of the bookmark specification. -
pdfBookmarkId
— The ID under which the bookmark will be stored in the PDF. -
type
— The type of the entry. For bookmarks, this will always be “pspdfkit/bookmark”. -
name
— The optional bookmark name. This is used to identify the bookmark. -
action
— The action that should be triggered when this bookmark is clicked. See [action types][actions] for more information about this field.
// Example of an Instant JSON schema for a bookmark with a `GoToAction` action: { "action": { "pageIndex": 0, "type": "goTo" }, "id": "01F46W3SCC92FG68G597N4VHJD", "name": "A page bookmark", "type": "pspdfkit/bookmark", "v": 1 }
declare type Bookmark = { v: 1, pdfBookmarkId?: string, type: "pspdfkit/bookmark", name?: string, action: Action };
Refer to the JSON format schema — actions guide for more information about supported action types.