PTBookmarkUtils
@interface PTBookmarkUtils : NSObject
A utility class for managing user bookmarks. Note the the PDF specification does not account for user bookmarks. Therefore user bookmarks are non-portable between PDF readers. PDFNet for iOS stores the bookmarks in the iOS user preferences.
The bookmark data is an NSArray of NSDictionary-s. Each NSDictionary represents a bookmark. The NSDictionary entries are: {@“page-number” : NSNumber numberWithInt}, {@“sdf-obj-number” : NSNumber numberWithInt}, {@“name” : NSString}, {@“unique-id” : NSString (a UUID string)}
-
This method updates a file’s bookmark data when the file is moved. If this method is not called when a file is moved, its bookmarks will no longer be associated with the file.
Declaration
Objective-C
+ (void)fileMovedFrom:(nonnull NSURL *)oldLocation to:(nonnull NSURL *)newLocation;Swift
class func fileMoved(from oldLocation: URL, to newLocation: URL)Parameters
oldLocationThe former location of the PDF file.
newLocationThe present location of the PDF file.
-
This method saves bookmark data back to disk.
Declaration
Objective-C
+ (void)saveBookmarkData:(nullable NSArray *)bookmarkData forFileUrl:(nonnull NSURL *)url;Swift
class func saveBookmarkData(_ bookmarkData: [Any]?, forFileUrl url: URL)Parameters
bookmarkDataThe bookmark data. See class documentation for data structure description.
urlThe location of the PDF file.
-
Retrieves the bookmark data from disk.
Declaration
Objective-C
+ (nonnull NSArray<NSMutableDictionary *> *)bookmarkDataForDocument: (nonnull NSURL *)documentUrl;Swift
class func bookmarkData(forDocument documentUrl: URL) -> [NSMutableDictionary]Parameters
documentUrlThe location of the PDF file.
Return Value
The bookmark data. See class documentation for data structure description.
-
Used to update user bookmarks when the
PTPDFDoc‘s page is moved.Declaration
Objective-C
+ (nonnull NSMutableArray<NSMutableDictionary *> *) updateUserBookmarks: (nonnull NSMutableArray<NSMutableDictionary *> *)bookmarks oldPageNumber:(unsigned int)oldPageNumber newPageNumber:(unsigned int)newPageNumber oldSDFNumber:(unsigned int)oldSDFNumber newSDFNumber:(unsigned int)newSDFNumber;Swift
class func updateUserBookmarks(_ bookmarks: NSMutableArray, oldPageNumber: UInt32, newPageNumber: UInt32, oldSDFNumber: UInt32, newSDFNumber: UInt32) -> NSMutableArrayParameters
bookmarksThe current bookmarks.
oldPageNumberThe original position of the page.
newPageNumberThe new position of the page.
oldSDFNumberThe SDF number of the page at the original location.
newSDFNumberThe SDF number of the page at the new location.
-
Deletes the bookmark data for the given document.
Declaration
Objective-C
+ (void)deleteBookmarkDataForDocument:(nonnull NSURL *)documentURL;Swift
class func deleteBookmarkData(forDocument documentURL: URL)Parameters
documentURLThe location of the PDF file.
-
Undocumented
Declaration
Objective-C
- (instancetype)init PT_UNAVAILABLE_MSG("Utility has no instance methods.");
PTBookmarkUtils Class Reference