PTBookmarkManager
@interface PTBookmarkManager : NSObject
An object that manages the user bookmarks inside PDF documents. User bookmarks can be created with
the PTUserBookmark class and stored inside a PTPDFDoc with a PTBookmarkManager instance.
-
Returns the shared bookmark manager object.
Declaration
Objective-C
@property (class, nonatomic, strong, readonly) PTBookmarkManager *_Nonnull defaultManager;Swift
class var `default`: PTBookmarkManager { get } -
Returns the root PDF bookmark in the given
PTPDFDocused to store user bookmarks.Declaration
Objective-C
- (nullable PTBookmark *)rootPDFBookmarkForDoc:(nonnull PTPDFDoc *)doc create:(BOOL)create;Swift
func rootPDFBookmark(for doc: PTPDFDoc, create: Bool) -> PTBookmark?Parameters
docthe
PTPDFDoccontaining user bookmarkscreateYESto create the root PDF bookmark if not found,NOotherwiseReturn Value
the root PDF bookmark in the given
PTPDFDoc, ornilif not found and not created. -
Removes the root PDF bookmark in the given
PTPDFDocused to store user bookmarks.Declaration
Objective-C
- (BOOL)removeRootPDFBookmarkForDoc:(nonnull PTPDFDoc *)doc;Swift
func removeRootPDFBookmark(for doc: PTPDFDoc) -> BoolParameters
docthe
PTPDFDoccontaining user bookmarksReturn Value
YESif the root bookmark was found and removed,NOotherwise -
Returns the user bookmarks for the given
PTPDFDoc.Declaration
Objective-C
- (nonnull NSArray<PTUserBookmark *> *)bookmarksForDoc:(nonnull PTPDFDoc *)doc;Swift
func bookmarks(for doc: PTPDFDoc) -> [PTUserBookmark]Parameters
docthe
PTPDFDoccontaining user bookmarksReturn Value
the user bookmarks for the given
PTPDFDoc -
Returns the user bookmarks for the given
PTPDFDocrooted at the specified PDF bookmark.Declaration
Objective-C
- (nonnull NSArray<PTUserBookmark *> *)bookmarksForDoc:(nonnull PTPDFDoc *)doc rootPDFBookmark:(nullable PTBookmark *) rootPDFBookmark;Swift
func bookmarks(for doc: PTPDFDoc, rootPDFBookmark: PTBookmark?) -> [PTUserBookmark]Parameters
docthe
PTPDFDoccontaining user bookmarksrootPDFBookmarkthe root PDF bookmark
Return Value
the user bookmarks for the given
PTPDFDocrooted at the specified PDF bookmark -
Saves the user bookmarks for the given
PTPDFDoc.Declaration
Objective-C
- (void)saveBookmarks:(nonnull NSArray<PTUserBookmark *> *)bookmarks forDoc:(nonnull PTPDFDoc *)doc;Swift
func save(_ bookmarks: [PTUserBookmark], for doc: PTPDFDoc)Parameters
bookmarksthe user bookmarks to save
docthe
PTPDFDocto save the bookmarks inside -
Adds a user bookmark for the given
PTPDFDoc.Declaration
Objective-C
- (void)addBookmark:(nonnull PTUserBookmark *)bookmark forDoc:(nonnull PTPDFDoc *)doc;Swift
func add(_ bookmark: PTUserBookmark, for doc: PTPDFDoc)Parameters
bookmarkthe user bookmark to add to the document
docthe
PTPDFDocto add the bookmark to -
Updates the user bookmarks in a document after a page has been moved.
Declaration
Objective-C
- (void)updateBookmarksForDoc:(nonnull PTPDFDoc *)doc pageMovedFromPageNumber:(int)oldPageNumber pageObjNum:(unsigned int)oldPageObjNum toPageNumber:(int)newPageNumber pageObjNum:(unsigned int)newPageObjNum;Swift
func updateBookmarks(for doc: PTPDFDoc, pageMovedFromPageNumber oldPageNumber: Int32, pageObjNum oldPageObjNum: UInt32, toPageNumber newPageNumber: Int32, pageObjNum newPageObjNum: UInt32)Parameters
docthe
PTPDFDoccontaining user bookmarks to updateoldPageNumberthe page’s original page number
oldPageObjNumthe page’s original SDF object number
newPageNumberthe page’s new page number
newPageObjNumthe page’s new SDF object number
-
Converts users bookmarks in JSON format to a list of
PTUserBookmarkobjects. The format of the JSON string is: {“0”: “Bookmark 1”, “1”: “Bookmark 2”}Declaration
Objective-C
- (nullable NSArray<PTUserBookmark *> *)bookmarksFromJSONString: (nonnull NSString *)jsonString;Swift
func bookmarks(fromJSONString jsonString: String) -> [PTUserBookmark]?Parameters
jsonStringthe user bookmarks in JSON format
Return Value
the list of
PTUserBookmarkobjects, ornilif the conversion failed -
Converts a list of
PTUserBookmarkobjects to a JSON format. The format of the JSON string is: {“0”: “Bookmark 1”, “1”: “Bookmark 2”}Declaration
Objective-C
- (nullable NSString *)JSONStringFromBookmarks: (nonnull NSArray<PTUserBookmark *> *)bookmarks;Swift
func jsonString(from bookmarks: [PTUserBookmark]) -> String?Parameters
bookmarksthe list of
PTUserBookmarkobjects to convertReturn Value
the user bookmarks in JSON format, or
nilif the conversion failed -
Imports user bookmarks in JSON format to the specified document. The format of the JSON string is: {“0”: “Bookmark 1”, “1”: “Bookmark 2”}
Declaration
Objective-C
- (void)importBookmarksForDoc:(nonnull PTPDFDoc *)doc fromJSONString:(nonnull NSString *)jsonString;Swift
func importBookmarks(for doc: PTPDFDoc, fromJSONString jsonString: String)Parameters
docthe
PTPDFDocto save the bookmarks insidejsonStringthe user bookmarks in JSON format
-
Export user bookmarks in JSON format from the specified document. The format of the JSON string is: {“0”: “Bookmark 1”, “1”: “Bookmark 2”}
Declaration
Objective-C
- (nullable NSString *)exportBookmarksFromDoc:(nonnull PTPDFDoc *)doc;Swift
func exportBookmarks(from doc: PTPDFDoc) -> String?Parameters
docthe
PTPDFDocto export the bookmarks fromReturn Value
the user bookmarks in JSON format, or
nilif the document contains no bookmarks or the JSON conversion failed
PTBookmarkManager Class Reference