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
BookmarkManagerSee
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 returnsfalse
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 itsidentifier
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 returnsfalse
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.