PSPDFBookmarkProvider

@protocol PSPDFBookmarkProvider <NSObject>

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

PSPDFBookmarkManager

See

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

    Declaration

    Objective-C

    @property (readonly, nonatomic) 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 shoud add the bookmark to its list and return YES. If it returns NO 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

    YES if the receiver consums the bookmark, NO 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 YES. If this method returns NO 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

    YES if the receiver removed the bookmark, NO 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()