Foxit PDF SDK
|
Instance Methods | |
(FSPDFDictionary *) | - getDict |
Get PDF dictionary of current bookmark. More... | |
(FSBookmark *) | - getFirstChild |
Get the first child bookmark. More... | |
(FSBookmark *) | - getNextSibling |
Get the next sibling bookmark. More... | |
(FSBookmark *) | - getParent |
Get the parent bookmark. More... | |
(BOOL) | - hasChild |
Check if current bookmark has child bookmark(s). More... | |
(id) | - initWithOther: |
Constructor, with another bookmark object. More... | |
(id) | - initWithPdf_doc:bookmark_dict: |
Constructor, with parameters. More... | |
(FSBookmark *) | - insert:position: |
Insert a new bookmark according to the relationship position to current bookmark. More... | |
(BOOL) | - isEmpty |
Check whether current object is empty or not. More... | |
(BOOL) | - isFirstChild |
Check if current bookmark is the first child of its parent bookmark. More... | |
(BOOL) | - isLastChild |
Check if current bookmark is the last child of its parent bookmark. More... | |
(BOOL) | - isRoot |
Check if current bookmark is the root bookmark. More... | |
(BOOL) | - moveTo:position: |
Move current bookmark to be child or sibling of another bookmark. More... | |
(BOOL) | - removeAction |
Remove action. More... | |
Properties | |
FSAction * | action |
Get or Set action. More... | |
unsigned int | color |
Get or Set the color used for displaying title. More... | |
FSDestination * | destination |
Get or Set the destination. More... | |
unsigned int | style |
Get or Set the style. More... | |
NSString * | title |
Get or Set the title. More... | |
PDF bookmark is also called "outline". It's a tree-structured hierarchy. It allows user to navigate PDF document easily by selecting a bookmark. One bookmark contains a destination or actions to indicate how to response when user selects it.
In order to get/set the bookmark tree, function PDFDoc::getRootBookmark must be called first to get the root of the whole bookmark tree. If the "root bookmark" does not exist, function PDFDoc::createRootBookmark could be called to create a new "root bookmark". Here, "root bookmark" is an abstract object. It represents the "Outline" of PDF document. For more details about "Outline", please refer to Section 8.2.3 in PDF Reference 1.7. "root bookmark" can only have some child bookmarks, but no parent, no next sibling bookmarks or any data (including bookmark data, destination data and action data). And "root bookmark" cannot be shown on the application UI since it has no data. So, for a root bookmark, only function Bookmark::getFirstChild can be used.
From the root bookmark, the bookmark tree can be traversed and each bookmark node can be accessed.
This class offers several functions to get/set other bookmarks from current bookmark. For example:
This class also offers functions to get/set the data of a PDF bookmark.
- (FSPDFDictionary *) getDict |
Get PDF dictionary of current bookmark.
- (FSBookmark *) getFirstChild |
Get the first child bookmark.
- (FSBookmark *) getNextSibling |
Get the next sibling bookmark.
If current bookmark is returned by function PDFDoc::getRootBookmark or PDFDoc::createRootBookmark, that means it is the "root bookmark", and it does not have any sibling bookmark. In this case, this function will return a bookmark object which's function Bookmark::isEmpty returns YES.
- (FSBookmark *) getParent |
Get the parent bookmark.
If current bookmark is returned by function PDFDoc::getRootBookmark or PDFDoc::createRootBookmark, that means it is the "root bookmark", and it does not have a parent bookmark. In this case, this function will return a bookmark object which's function Bookmark::isEmpty returns YES.
- (BOOL) hasChild |
Check if current bookmark has child bookmark(s).
- (id) initWithOther: | (FSBookmark*) | other |
Constructor, with another bookmark object.
[in] | other | Another bookmark object. |
- (id) initWithPdf_doc: | (FSPDFDoc*) | pdf_doc | |
bookmark_dict: | (FSPDFDictionary*) | bookmark_dict | |
Constructor, with parameters.
[in] | pdf_doc | A valid PDF document object. |
[in] | bookmark_dict | A PDF dictionary which represents a bookmark. This PDF dictionary should have existed in the PDF document represented by parameter pdf_doc. |
- (FSBookmark *) insert: | (NSString *) | title | |
position: | (FSBookmarkPosition) | position | |
Insert a new bookmark according to the relationship position to current bookmark.
For the new bookmark, the color would be 0x000000 and the style would be FSBookmarkStyleNormal by default.
[in] | title | Title string for the new bookmark. It should not be an empty string. |
[in] | position | The position where the new bookmark item is to be inserted, based on current bookmark. Please refer to values starting from FSBookmarkPosFirstChild and this should be one of these values. If current bookmark is just the "root bookmark", parameter position can only be FSBookmarkPosFirstChild or FSBookmarkPosLastChild. |
- (BOOL) isEmpty |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
- (BOOL) isFirstChild |
Check if current bookmark is the first child of its parent bookmark.
- (BOOL) isLastChild |
Check if current bookmark is the last child of its parent bookmark.
- (BOOL) isRoot |
Check if current bookmark is the root bookmark.
"root bookmark" is an abstract object. It represents the "Outline" of PDF document. For more details about "Outline", please refer to Section 8.2.3 in PDF Reference 1.7. "root bookmark" can only have some child bookmarks, but no parent, no next sibling bookmarks or any data (including bookmark data, destination data and action data). And "root bookmark" cannot be shown on the application UI since it has no data.
- (BOOL) moveTo: | (FSBookmark*) | dest_bookmark | |
position: | (FSBookmarkPosition) | position | |
Move current bookmark to be child or sibling of another bookmark.
If current bookmark is returned by function PDFDoc::getRootBookmark or PDFDoc::createRootBookmark, that means it is the "root bookmark", and it cannot be moved to be child or sibling of any bookmark in the bookmark tree. In this case, this function will return NO directly.
[in] | dest_bookmark | The destination bookmark. It should not be current bookmark itself or any descendant of current bookmark. Current bookmark will be moved to be child or sibling of the destination bookmark. |
[in] | position | The position where the current bookmark is to be moved to, based on parameter destBookmark. Please refer to values starting from FSBookmarkPosFirstChild and this should be one of these values. |
- (BOOL) removeAction |
Remove action.
When removing bookmark's action, bookmark's destination will be removed at the same time.
If current bookmark is returned by function PDFDoc::getRootBookmark or PDFDoc::createRootBookmark, that means it is the "root bookmark", and it does not have any action information. In this case, this function will return YES directly.
|
readwritenonatomicweak |
Get or Set action.
If current bookmark is returned by function PDFDoc::getRootBookmark or PDFDoc::createRootBookmark, that means it is the "root bookmark", and it does not have any action information. In this case, this function will return an action object which's function actions::Action::isEmpty returns YES.
|
readwritenonatomicassign |
Get or Set the color used for displaying title.
If current bookmark is returned by function PDFDoc::getRootBookmark or PDFDoc::createRootBookmark, that means it is the "root bookmark", and it does not have color. In this case, this function will return 0x000000 by default.
|
readwritenonatomicweak |
Get or Set the destination.
Bookmark's destination is some place in current document where the bookmark can "goto". If the bookmark cannot "goto" any place in current document, that means no destination information can be retrieved and this function will return a destination object which's function Destination::isEmpty returns YES.
If current bookmark is returned by function PDFDoc::getRootBookmark or PDFDoc::createRootBookmark, that means it is the "root bookmark", and it does not have any destination information. In this case, this function will return a destination object which's function Destination::isEmpty returns YES.
|
readwritenonatomicassign |
Get or Set the style.
If current bookmark is returned by function PDFDoc::getRootBookmark or PDFDoc::createRootBookmark, that means it is the "root bookmark", and it does not have style information. In this case, this function will return FSBookmarkStyleNormal by default.
|
readwritenonatomicweak |
Get or Set the title.
If current bookmark is returned by function PDFDoc::getRootBookmark or PDFDoc::createRootBookmark, that means it is the "root bookmark", and it does not have title. In this case, this function will return an empty string.