java.lang.Object | |
↳ | com.pdftron.pdf.utils.BookmarkManager |
A utility class for handling bookmarks in PDF
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
BookmarkManager() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static void |
addPdfBookmark(Context context, PDFViewCtrl pdfViewCtrl, long pageObjNum, int pageNumber)
Adds a PDF bookmark.
| ||||||||||
static void |
addUserBookmark(Context context, String filePath, long pageObjNum, int pageNumber)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Adds a user bookmark
| ||||||||||
static void |
addUserBookmark(Context context, PDFViewCtrl pdfViewCtrl, String filePath, long pageObjNum, int pageNumber)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Adds a user bookmark
| ||||||||||
static String |
exportPdfBookmarks(PDFDoc pdfDoc)
Exports user bookmark json from a document
| ||||||||||
static String |
exportUserBookmarks(Context context, String filePath)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Exports user bookmark json from a document
| ||||||||||
static ArrayList<UserBookmarkItem> |
fromJSON(String bookmarkJson)
Converts user bookmarks json to list of
UserBookmarkItem | ||||||||||
static ArrayList<Bookmark> |
getBookmarkList(PDFDoc pdfDoc, Bookmark firstSibling)
Returns the list of sibling bookmarks after the specified bookmark.
| ||||||||||
static ArrayList<Bookmark> |
getBookmarkListByTitle(PDFDoc pdfDoc, String queryText, boolean isSearchActive)
Returns the list of sibling bookmarks after the specified bookmark.
| ||||||||||
static ArrayList<Integer> |
getPdfBookmarkedPageNumbers(PDFDoc pdfDoc)
Returns array of integer indicate page number that contains bookmark
| ||||||||||
static List<UserBookmarkItem> |
getPdfBookmarks(PDFDoc pdfDoc, String queryText)
Returns pdf bookmarks.
| ||||||||||
static List<UserBookmarkItem> |
getPdfBookmarks(Bookmark rootBookmark)
Returns pdf bookmarks.
| ||||||||||
static List<UserBookmarkItem> |
getPdfBookmarks(PDFDoc pdfDoc)
Returns pdf bookmarks.
| ||||||||||
static List<UserBookmarkItem> |
getPdfBookmarks(Bookmark rootBookmark, String queryText)
Returns pdf bookmarks.
| ||||||||||
static Bookmark |
getRootPdfBookmark(PDFDoc pdfDoc, boolean createNew)
Returns the root PDF bookmark
| ||||||||||
static List<UserBookmarkItem> |
getUserBookmarks(Context context, String filePath)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Returns user bookmarks.
| ||||||||||
static List<UserBookmarkItem> |
getUserBookmarks(Context context, String filePath, String queryText)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Returns user bookmarks.
| ||||||||||
static void |
importPdfBookmarks(PDFViewCtrl pdfViewCtrl, String bookmarkJson)
Imports user bookmark json to a document
This will save the user bookmarks to the associated
PDFDoc | ||||||||||
static void |
importUserBookmarks(Context context, PDFViewCtrl pdfViewCtrl, String filePath, String bookmarkJson)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Imports user bookmark json to SharedPreferences
This will NOT alter the document
| ||||||||||
static void |
importUserBookmarks(Context context, String filePath, String bookmarkJson)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Imports user bookmark json to SharedPreferences
This will NOT alter the document
| ||||||||||
static void |
onPageDeleted(Context context, PDFViewCtrl pdfViewCtrl, String filePath, Long objNumber, int pageNumber, int pageCount)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Handles bookmarks when a user bookmarks is deleted.
| ||||||||||
static void |
onPageDeleted(PDFViewCtrl pdfViewCtrl, Long objNumber)
Handles bookmarks when a pdf bookmark is deleted.
| ||||||||||
static void |
onPageDeleted(Context context, String filePath, Long objNumber, int pageNumber, int pageCount)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Handles bookmarks when a user bookmarks is deleted.
| ||||||||||
static void |
onPageMoved(PDFViewCtrl pdfViewCtrl, long objNumber, long newObjNumber, int newPageNumber, boolean rebuild)
Handles bookmarks when a pdf bookmarks is moved.
| ||||||||||
static void |
onPageMoved(Context context, String filePath, long objNumber, long newObjNumber, int oldPageNumber, int newPageNumber)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Handles bookmarks when a user bookmarks is moved.
| ||||||||||
static void |
onPageMoved(Context context, PDFViewCtrl pdfViewCtrl, String filePath, long objNumber, long newObjNumber, int oldPageNumber, int newPageNumber)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Handles bookmarks when a user bookmarks is moved.
| ||||||||||
static void |
removePdfBookmark(Context context, PDFViewCtrl pdfViewCtrl, long pageObjNum, int pageNumber)
Removes a PDF bookmark.
| ||||||||||
static boolean |
removeRootPdfBookmark(PDFViewCtrl pdfViewCtrl, boolean shouldTakeUndoSnapshot)
Removes the root PDF bookmark.
| ||||||||||
static void |
removeUserBookmark(Context context, PDFViewCtrl pdfViewCtrl, String filePath, long pageObjNum, int pageNumber)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Removes a user bookmark
| ||||||||||
static void |
removeUserBookmark(Context context, String filePath, long pageObjNum, int pageNumber)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Removes a user bookmark
| ||||||||||
static void |
removeUserBookmarks(Context context, String filePath)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Removes user bookmarks.
| ||||||||||
static void |
savePdfBookmarks(PDFViewCtrl pdfViewCtrl, List<UserBookmarkItem> data, boolean shouldTakeUndoSnapshot, boolean rebuild)
Saves PDF bookmarks.
| ||||||||||
static void |
saveUserBookmarks(Context context, String filePath, List<UserBookmarkItem> data)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Saves user bookmarks.
| ||||||||||
static void |
saveUserBookmarks(Context context, PDFViewCtrl pdfViewCtrl, String filePath, List<UserBookmarkItem> data)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Saves user bookmarks.
| ||||||||||
static String |
toJSON(List<UserBookmarkItem> bookmarkItems)
Converts list of
UserBookmarkItem to user bookmarks json in format: {"0":"Bookmark 1","1":"Bookmark 2"} | ||||||||||
static void |
updateUserBookmarkPageObj(Context context, PDFViewCtrl pdfViewCtrl, String filePath, long pageObjNum, long newPageObjNum, int newPageNum)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Updates user bookmark page object number.
| ||||||||||
static void |
updateUserBookmarkPageObj(Context context, String filePath, long pageObjNum, long newPageObjNum, int newPageNum)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Updates user bookmark page object number.
| ||||||||||
static void |
updateUserBookmarksFilePath(Context context, String oldPath, String newPath)
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED
Updates user bookmark file path.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Adds a PDF bookmark.
context | The context |
---|---|
pdfViewCtrl | The PDFViewCtrl |
pageObjNum | The page object number |
pageNumber | The page number |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Adds a user bookmark
context | The context |
---|---|
filePath | The file path |
pageObjNum | The page object number |
pageNumber | The page number |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Adds a user bookmark
context | The context |
---|---|
pdfViewCtrl | The PDFViewCtrl |
filePath | The file path |
pageObjNum | The page object number |
pageNumber | The page number |
Exports user bookmark json from a document
pdfDoc | the document |
---|
JSONException |
---|
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Exports user bookmark json from a document
context | the Context |
---|---|
filePath | the file path |
JSONException |
---|
Converts user bookmarks json to list of UserBookmarkItem
bookmarkJson | the user bookmark json in format: {"0":"Bookmark 1","1":"Bookmark 2"} |
---|
UserBookmarkItem
JSONException |
---|
Returns the list of sibling bookmarks after the specified bookmark. Note: if the specified bookmark is null the sibling bookmarks after the first bookmark in the document will be returned. If the specified bookmark is null and there is no sibling then all bookmarks under the first bookmark will be returned.
pdfDoc | The PDF doc |
---|---|
firstSibling | The first sibling |
Returns the list of sibling bookmarks after the specified bookmark. Note: if the specified bookmark is null the sibling bookmarks after the first bookmark in the document will be returned. If the specified bookmark is null and there is no sibling then all bookmarks under the first bookmark will be returned.
pdfDoc | The PDF doc |
---|---|
queryText | The string used to filter bookmarks by title |
isSearchActive | Boolean to indicate if search is active |
Returns array of integer indicate page number that contains bookmark
Returns pdf bookmarks.
pdfDoc | the document |
---|---|
queryText | The string used to filter bookmarks by title |
Returns pdf bookmarks.
rootBookmark | The root PDF bookmark |
---|
Returns pdf bookmarks.
pdfDoc | the document |
---|
Returns pdf bookmarks.
rootBookmark | The root PDF bookmark |
---|---|
queryText | The string used to filter bookmarks by title |
Returns the root PDF bookmark
pdfDoc | The PDFDoc |
---|---|
createNew | True if should create new bookmark object if doc doesn't have any |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Returns user bookmarks.
context | The context |
---|---|
filePath | The file path |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Returns user bookmarks.
context | The context |
---|---|
filePath | The file path |
queryText | The string used to filter bookmarks by title |
Imports user bookmark json to a document
This will save the user bookmarks to the associated PDFDoc
pdfViewCtrl | the PDFViewCtrl associated with the document |
---|---|
bookmarkJson | the user bookmark json in format: {"0":"Bookmark 1","1":"Bookmark 2"} |
JSONException |
---|
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Imports user bookmark json to SharedPreferences This will NOT alter the document
context | the Context |
---|---|
pdfViewCtrl | the PDFViewCtrl |
filePath | the file path |
bookmarkJson | the user bookmark json in format: {"0":"Bookmark 1","1":"Bookmark 2"} |
JSONException |
---|
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Imports user bookmark json to SharedPreferences This will NOT alter the document
context | the Context |
---|---|
filePath | the file path |
bookmarkJson | the user bookmark json in format: {"0":"Bookmark 1","1":"Bookmark 2"} |
JSONException |
---|
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Handles bookmarks when a user bookmarks is deleted.
context | The context |
---|---|
pdfViewCtrl | The PDFViewCtrl |
filePath | The file path |
objNumber | The page object number |
pageNumber | The page number |
pageCount | The number of pages |
Handles bookmarks when a pdf bookmark is deleted.
pdfViewCtrl | The PDFViewCtrl |
---|---|
objNumber | The object number |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Handles bookmarks when a user bookmarks is deleted.
context | The context |
---|---|
filePath | The file path |
objNumber | The page object number |
pageNumber | The page number |
pageCount | The number of pages |
Handles bookmarks when a pdf bookmarks is moved.
pdfViewCtrl | The PDFViewCtrl |
---|---|
objNumber | The object number before moving |
newObjNumber | The object number after moving |
newPageNumber | The new page number |
rebuild | True if should rebuild the root bookmark |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Handles bookmarks when a user bookmarks is moved.
context | The context |
---|---|
filePath | The file path |
objNumber | The old page object number |
newObjNumber | The new page object number |
oldPageNumber | The page number before moving |
newPageNumber | the page number after moving |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Handles bookmarks when a user bookmarks is moved.
context | The context |
---|---|
pdfViewCtrl | The PDFViewCtrl |
filePath | The file path |
objNumber | The old page object number |
newObjNumber | The new page object number |
oldPageNumber | The page number before moving |
newPageNumber | the page number after moving |
Removes a PDF bookmark. A write lock is expected around this call.
context | The context |
---|---|
pdfViewCtrl | The PDFViewCtrl |
pageObjNum | The page object number |
pageNumber | The page number |
PDFNetException |
---|
Removes the root PDF bookmark.
pdfViewCtrl | The PDFViewCtrl |
---|---|
shouldTakeUndoSnapshot | True if should take undo snapshot |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Removes a user bookmark
context | The context |
---|---|
pdfViewCtrl | The PDFViewCtrl |
filePath | The file path |
pageObjNum | The page object number |
pageNumber | The page number |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Removes a user bookmark
context | The context |
---|---|
filePath | The file path |
pageObjNum | The page object number |
pageNumber | The page number |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Removes user bookmarks.
context | The context |
---|---|
filePath | The file path |
Saves PDF bookmarks.
pdfViewCtrl | the PDFViewCtrl |
---|---|
data | A list of user bookmarks |
shouldTakeUndoSnapshot | True if should take undo snapshot |
rebuild | True if should rebuild the root bookmark |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Saves user bookmarks.
context | The context |
---|---|
filePath | The file path |
data | The user bookmarks |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Saves user bookmarks.
context | The context |
---|---|
filePath | The file path |
data | The user bookmarks |
Converts list of UserBookmarkItem
to user bookmarks json in format: {"0":"Bookmark 1","1":"Bookmark 2"}
bookmarkItems | the list of UserBookmarkItem |
---|
JSONException |
---|
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Updates user bookmark page object number.
context | The context |
---|---|
pdfViewCtrl | The PDFViewCtrl |
filePath | The file path |
pageObjNum | The old page object number |
newPageObjNum | The new page object number |
newPageNum | The new page number |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Updates user bookmark page object number.
context | The context |
---|---|
filePath | The file path |
pageObjNum | The old page object number |
newPageObjNum | The new page object number |
newPageNum | The new page number |
ONLY USE WHEN DOCUMENT CANNOT BE ALTERED Updates user bookmark file path.
context | The context |
---|---|
oldPath | The old file path |
newPath | The new file path |