Bookmarks
-
A bookmark encapsulates a PDF action and a name. It is managed by a document’s bookmark manager.
See
BookmarkManagerDeclaration
Objective-C
@interface PSPDFBookmark : PSPDFModel <NSCopying, NSMutableCopying, NSSecureCoding, PSPDFOverridable>
Swift
class Bookmark : ModelObject, NSCopying, NSMutableCopying, NSSecureCoding, Overridable
-
The
BookmarkManager
manages bookmarks for a givenDocument
.You should not initialize a bookmark manager yourself but instead access it through the document’s
bookmarkManager
property.Bookmarks and PDF files
The concept of bookmarks does not exist in a PDF document. Therefore all the bookmarks you add will be stored inside the PDF but are only read by PSPDFKit and Apple Preview. If you want to support other formats, you need to create your own bookmark provider and store them yourself.
Subclassing
You should not subclass
BookmarkManager
. Instead attach a custom bookmark provider to achieve your desired behavior.Thread Safety
BookmarkManager
is thread safe and can be accessed from any thread. To ensure multiple operations are executed as one serial block without other threads interfering, wrap you operations inperformBlock:
orperformBlockAndWait:
whenever you need to do complex operations.However, if you need to do something that can be achieved by calling a single method on this class (e.g. adding a bookmark or removing a known bookmark), call the appropriate method directly as it is more performant than wrapping calls in the above mentioned block calls.
See moreDeclaration
Objective-C
@interface PSPDFBookmarkManager : NSObject
Swift
class BookmarkManager : 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
BookmarkManagerSee
PSPDFBookmarksChangedNotification for change notifications.Declaration
Objective-C
@protocol PSPDFBookmarkProvider <NSObject>
Swift
protocol BookmarkProvider : NSObjectProtocol