PSPDFBookmarkProvider

Objective-C

@protocol PSPDFBookmarkProvider <NSObject>

Swift

protocol BookmarkProvider : NSObjectProtocol

A Bookmark Provider is used to store and read bookmarks from a data source.

If you need to store bookmarks in a file format other than what PSPDFKit supports by default, you can create your own bookmark provider and attach it to a document’s bookmark manager.

See

BookmarkManager

See

PSPDFBookmarksChangedNotification for change notifications.
  • Contains all bookmarks that are currently owned by the bookmark provider.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSArray<PSPDFBookmark *> *_Nonnull bookmarks;

    Swift

    var bookmarks: [PSPDFBookmark] { get }
  • Adds a bookmark to the bookmark provider if the given bookmark should be owned by the receiver.

    The receiver should decide if it wants to manage this bookmark. If it does, it should add the bookmark to its list and return true. If it returns false the next bookmark provider in the list is asked.

    Note

    You will receive calls to addBookmark: with updated bookmarks that already exist in a provider in an outdated version. You can determine if you are already the owner of a bookmark by comparing its identifier property with the ones from your list of bookmarks.

    Declaration

    Objective-C

    - (BOOL)addBookmark:(nonnull PSPDFBookmark *)bookmark;

    Swift

    func add(_ bookmark: PSPDFBookmark) -> Bool

    Parameters

    bookmark

    The bookmark that should be added to the receiver.

    Return Value

    true if the receiver successfully added the bookmark, false otherwise.

  • Removes a bookmark from the bookmark provider if the given bookmark is owned by the receiver.

    The receiver should check if the given bookmark is owned by itself. If this is the case, it should remove the bookmark from the list and return true. If this method returns false the next bookmark provider in the list is asked.

    Declaration

    Objective-C

    - (BOOL)removeBookmark:(nonnull PSPDFBookmark *)bookmark;

    Swift

    func remove(_ bookmark: PSPDFBookmark) -> Bool

    Parameters

    bookmark

    The bookmark that should be removed from the receiver.

    Return Value

    true if the receiver successfully removed the bookmark, false otherwise.

  • Tells the bookmark provider to persist the bookmarks it is managing.

    Most likely this method is called because the associated document is about to be saved.

    Declaration

    Objective-C

    - (void)save;

    Swift

    func save()