PSPDFBookmark
Objective-C
@interface PSPDFBookmark
: PSPDFModel <NSCopying, NSMutableCopying, NSSecureCoding, PSPDFOverridable>
Swift
class Bookmark : ModelObject, NSCopying, NSMutableCopying, NSSecureCoding, Overridable
A bookmark encapsulates a PDF action and a name. It is managed by a document’s bookmark manager.
See
BookmarkManager-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Initialize with an action object.
Note
Subclassing: This might not be called when bookmarks are created internally from the PDF.Declaration
Objective-C
- (nullable instancetype)initWithAction:(nonnull PSPDFAction *)action;
Swift
init?(action: PSPDFAction)
-
Initialize a bookmark that was previously serialized with a coder.
Declaration
Objective-C
- (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder;
Swift
init?(coder aDecoder: NSCoder)
Parameters
aDecoder
The decoder to decode the bookmark data.
Return Value
The decoded bookmark object or
nil
if decoding was not possible. -
The PDF action. Usually this will be of type
PSPDFGoToAction
, but all action types are possible.Declaration
Objective-C
@property (nonatomic, copy, readonly) PSPDFAction *_Nonnull action;
Swift
@NSCopying var action: PSPDFAction { get }
-
A bookmark can have a name. This is optional.
Declaration
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *name;
Swift
var name: String? { get }
-
Contains the name of the bookmark or, if the bookmark does not have a valid name, a default name.
Declaration
Objective-C
@property (nonatomic, readonly) NSString *_Nonnull displayName;
Swift
var displayName: String { get }
-
A string uniquely identifying the bookmark.
Two bookmarks with an equal identifier are considered equal.
Note
You should treat this as an opaque value and don’t make any assumptions about it. This property is just meant for custom bookmark providers to properly store a bookmark.Declaration
Objective-C
@property (nonatomic, readonly) NSString *_Nonnull identifier;
Swift
var identifier: String { get }
-
A number used for the custom sorting option.
Note
You should treat this as an opaque value and don’t make any assumptions about it. This property is just meant for custom bookmark providers to properly store a bookmark.Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSNumber *sortKey;
Swift
var sortKey: NSNumber? { get }
-
Initializes a new bookmark with the given identifier, action, name and sort key.
This initializer is meant to be used from inside a bookmark provider only, when loading bookmarks.
Warning
Only pass values into the
identifier
andsortKey
initializer that you previously got from another bookmark during a save operation. Passing other values to this identifier leads to undefined behavior.Declaration
Objective-C
- (nonnull instancetype)initWithIdentifier:(nonnull NSString *)identifier action:(nonnull PSPDFAction *)action name:(nullable NSString *)name sortKey:(nullable NSNumber *)sortKey;
Swift
convenience init(identifier: String, action: PSPDFAction, name: String?, sortKey: NSNumber?)
Parameters
identifier
The identifier of a bookmark, previously read from a bookmark’s
identifier
property.action
The action the bookmark executes when selected.
name
The name of the bookmark or
nil
if the bookmark does not have a name.sortKey
The sortKey of a bookmark, previously read from a bookmark’s
sortKey
property ornil
.Return Value
A new, fully configured instance of a bookmark.
-
Initialize with page. Convenience initialization that will create a
PSPDFGoToAction
.Declaration
Objective-C
- (nonnull instancetype)initWithPageIndex:(PSPDFPageIndex)pageIndex;
Swift
convenience init(pageIndex: PageIndex)
-
Convenience shortcut for self.action.pageIndex (if action is of type
PSPDFGoToAction
) Page is set toNSNotFound
if action is nil or a different type.Declaration
Objective-C
@property (nonatomic, readonly) PSPDFPageIndex pageIndex;
Swift
var pageIndex: PageIndex { get }