Skip to content
Guides

Bookmarks

Bookmarks are user-created markers, which is used to identify and quickly navigate to specific locations in a document. Unlike outlines, bookmarks are manually added by users, typically reflecting their personalized interests in the document content.

Bookmarks offer a user-customized navigation method, enabling users to create personalized markers within a document. Users can swiftly navigate to bookmarked locations without the need to browse through the entire document.

Retrieve the list of bookmarks

This example shows how to get the bookmarks list:

swift
var bookmarks = document?.bookmarks()
objective-c
NSArray *bookmarks = document.bookmarks;

Add a New Bookmark

The steps for adding a new bookmark are as follows:

  1. Create a bookmark object.
  2. Set bookmark properties.
  3. Add the bookmark to the document.

This example shows how to add a new bookmark:

swift
document?.addBookmark("new bookmark", forPageIndex:0)
objective-c
[document addBookmark:@"new bookmark" forPageIndex:0];

Delete a Bookmark

Delete the bookmark for a specified page number.

This example shows how to delete a bookmark:

swift
// Delete the bookmark for the first page.
document?.removeBookmark(forPageIndex:0)
objective-c
// Delete the bookmark for the first page.
[document removeBookmarkForPageIndex:0];