FoxitPDFSDKforWeb  v10.0.0
Foxit PDF SDK for Web
BookmarkDataService Class Reference

Provides functionality for management and manipulation of bookmark-related data. More...

Public Member Functions

 addBookmark (options)
 Creates a new bookmark with the specified options. More...
 
 cutBookmark (bookmarkNodeId, parentBookmarkNodeId)
 Mark a bookmark node as cut. More...
 
 deleteBookmark (destBookmarkNodeId)
 Deletes the bookmark with the specified bookmark node id. More...
 
Promise< BookmarkData[]> getBookmarkChildren (bookmarkNodeId)
 Retrieves the children of a bookmark for the given bookmark node id. More...
 
 getBookmarkData (bookmarkNodeId)
 Retrieves the bookmark data for the given bookmark node id. More...
 
 getDestination ()
 Retrieves the current position of the PDF pages in the viewport. More...
 
 getFirstLevelBookmarks ()
 Retrieves the bookmarks at the first level of the bookmark hierarchy. More...
 
 getParentBookmarkId (bookmarkNodeId)
 Retrieves the parent bookmark node id for the given bookmark node id. More...
 
 moveBookmark (srcBookmarkNodeId, srcParentBookmarkNodeId, destBookmarkNodeId, destParentBookmarkNodeId, relationship)
 Moves the bookmark with the specified source node id to the specified destination. More...
 
void onBookmarkAdded (callback)
 Registers a callback to be invoked when a bookmark is added. More...
 
 onBookmarkChildrenReloaded (callback)
 Registers a callback to be invoked when the children of a bookmark are reloaded. More...
 
void onBookmarkDeleted (callback)
 Registers a callback to be invoked when a bookmark is deleted. More...
 
 onBookmarkMoved (callback)
 Registers a callback to be invoked when a bookmark is moved. More...
 
void onBookmarkPropertiesUpdated (callback)
 Registers a callback to be invoked when bookmark properties are updated. More...
 
 onPasteCutBookmark (callback)
 Registers a callback to be invoked when pasting a cut bookmark. More...
 
Promise< void > pasteCutBookmark (destBookmarkId, destParentBookmarkId, relationship)
 Move the cut bookmark node to the specified position according to the relationship. If there are no bookmarks to be cut, this method does nothing. More...
 
 performAction (bookmarkNodeId)
 Performs an action associated with the bookmark node id. More...
 
Promise< void > reloadBookmarkChildren (parentBookmarkNodeId)
 Reloads the bookmark data for the given bookmark node id. More...
 
 renameBookmark (bookmarkNodeId, newTitle)
 Renames the bookmark with the specified node id to the new title. More...
 
 setColor (bookmarkNodeId, newColor)
 Updates the font color of the specified node id. More...
 
 setDestination (bookmarkNodeId, newDestination)
 Updates the destination for the bookmark with the specified node id. More...
 
 setFontStyle (bookmarkNodeId, style)
 Updates the font style of the specified node ID. More...
 

Detailed Description

Provides functionality for management and manipulation of bookmark-related data.

Since
10.0.0

Member Function Documentation

◆ addBookmark()

BookmarkDataService::addBookmark ( options  )

Creates a new bookmark with the specified options.

Parameters
optionsAddBookmarkOptions - Options for creating the new bookmark.
Returns
Promise<number|undefined> - A Promise that resolves with the new bookmark node id, or undefined if not created successfully.
See also
onBookmarkAdded
Since
10.0.0

◆ cutBookmark()

BookmarkDataService::cutBookmark ( bookmarkNodeId  ,
parentBookmarkNodeId   
)

Mark a bookmark node as cut.

Parameters
bookmarkNodeIdnumber - The bookmark node id.
parentBookmarkNodeIdnumber|undefined - The parent bookmark node id.
Returns
void
See also
pasteCutBookmark
Since
10.0.0

◆ deleteBookmark()

BookmarkDataService::deleteBookmark ( destBookmarkNodeId  )

Deletes the bookmark with the specified bookmark node id.

Parameters
destBookmarkNodeIdnumber - The bookmark node id to be deleted.
Returns
Promise<void> - A Promise that resolves when the bookmark is deleted.
See also
onBookmarkDeleted
Since
10.0.0

◆ getBookmarkChildren()

Promise<BookmarkData[]> BookmarkDataService::getBookmarkChildren ( bookmarkNodeId  )

Retrieves the children of a bookmark for the given bookmark node id.

Parameters
bookmarkNodeIdnumber|undefined - The parent bookmark node id, or undefined if need get the first level bookmark nodes.
Returns
Promise<BookmarkData[]> - A Promise that resolves with an array of bookmark data.
Since
10.0.0

◆ getBookmarkData()

BookmarkDataService::getBookmarkData ( bookmarkNodeId  )

Retrieves the bookmark data for the given bookmark node id.

Parameters
bookmarkNodeIdnumber - The bookmark node id.
Returns
Promise<BookmarkData> - A Promise that resolves with the bookmark data.
Since
10.0.0

◆ getDestination()

BookmarkDataService::getDestination ( )

Retrieves the current position of the PDF pages in the viewport.

Returns
Promise<BookmarkDestination> - A Promise that resolves with the current position.
See also
setDestination
Since
10.0.0

◆ getFirstLevelBookmarks()

BookmarkDataService::getFirstLevelBookmarks ( )

Retrieves the bookmarks at the first level of the bookmark hierarchy.

Returns
Promise<BookmarkData[]> - A promise that resolves with an array of bookmark data.
Since
10.0.0

◆ getParentBookmarkId()

BookmarkDataService::getParentBookmarkId ( bookmarkNodeId  )

Retrieves the parent bookmark node id for the given bookmark node id.

Parameters
bookmarkNodeIdnumber - The bookmark node id.
Returns
number|undefined - The parent bookmark node id, or undefined if the bookmark node is at the first level.
Since
10.0.0

◆ moveBookmark()

BookmarkDataService::moveBookmark ( srcBookmarkNodeId  ,
srcParentBookmarkNodeId  ,
destBookmarkNodeId  ,
destParentBookmarkNodeId  ,
relationship   
)

Moves the bookmark with the specified source node id to the specified destination.

Parameters
srcBookmarkNodeIdnumber - The source bookmark node id.
srcParentBookmarkNodeIdnumber|undefined - The source parent bookmark node id.
destBookmarkNodeIdnumber|undefined - The destination bookmark node id.
destParentBookmarkNodeIdnumber|undefined - The destination parent bookmark node id.
relationshipBookmarkRelationship - The relationship between source and destination.
See also
onBookmarkMoved
Since
10.0.0

◆ onBookmarkAdded()

void BookmarkDataService::onBookmarkAdded ( callback  )

Registers a callback to be invoked when a bookmark is added.

Parameters
callback(event:AddBookmarkEvent)=>void - A function that will be called when a AddBookmarkEvent occurs.
Returns
()=>void - Function to unregister the callback.
See also
addBookmark
Since
10.0.0

◆ onBookmarkChildrenReloaded()

BookmarkDataService::onBookmarkChildrenReloaded ( callback  )

Registers a callback to be invoked when the children of a bookmark are reloaded.

Parameters
callback(parentBookmarkNodeId: number|undefined, children: BookmarkData[])=>void - Callback function to handle bookmark children reload.
Returns
()=>void - Function to unregister the callback.
Since
10.0.0

◆ onBookmarkDeleted()

void BookmarkDataService::onBookmarkDeleted ( callback  )

Registers a callback to be invoked when a bookmark is deleted.

Parameters
callback(event:DeleteBookmarkEvent)=>void - A function that will be called when a DeleteBookmarkEvent occurs.
Returns
()=>void - Function to unregister the callback.
See also
deleteBookmark
Since
10.0.0

◆ onBookmarkMoved()

BookmarkDataService::onBookmarkMoved ( callback  )

Registers a callback to be invoked when a bookmark is moved.

Parameters
callback(event:MoveBookmarkEvent)=>void - A function that will be called when a MoveBookmarkEvent occurs.
Returns
()=>void - Function to unregister the callback.
See also
moveBookmark
pasteCutBookmark
Since
10.0.0

◆ onBookmarkPropertiesUpdated()

void BookmarkDataService::onBookmarkPropertiesUpdated ( callback  )

Registers a callback to be invoked when bookmark properties are updated.

Parameters
callback(event:UpdateBookmarkPropertiesEvent)=>void - A function that will be called when a UpdateBookmarkPropertiesEvent occurs.
Returns
()=>void - Function to unregister the callback.
See also
renameBookmark
setColor
setFontStyle
Since
10.0.0

◆ onPasteCutBookmark()

BookmarkDataService::onPasteCutBookmark ( callback  )

Registers a callback to be invoked when pasting a cut bookmark.

Parameters
callback(info:PasteCutBookmarkInfo)=>void - Callback function to handle when pasting a cut bookmark
Returns
()=>void - Function to unregister the callback.
See also
cutBookmark
pasteCutBookmark
Since
10.0.0

◆ pasteCutBookmark()

Promise<void> BookmarkDataService::pasteCutBookmark ( destBookmarkId  ,
destParentBookmarkId  ,
relationship   
)

Move the cut bookmark node to the specified position according to the relationship. If there are no bookmarks to be cut, this method does nothing.

Parameters
destBookmarkIdnumber - The destination bookmark node id.
destParentBookmarkIdnumber|undefined - The parent id of the destination bookmark node.
relationshipBookmarkRelationship - The relationship between source and destination.
Returns
Promise<void> -
See also
onPasteCutBookmark
cutBookmark
Since
10.0.0

◆ performAction()

BookmarkDataService::performAction ( bookmarkNodeId  )

Performs an action associated with the bookmark node id.

Parameters
bookmarkNodeIdnumber - The bookmark node id.
Returns
Promise<void> - A Promise that resolves when the action is performed.
Since
10.0.0

◆ reloadBookmarkChildren()

Promise<void> BookmarkDataService::reloadBookmarkChildren ( parentBookmarkNodeId  )

Reloads the bookmark data for the given bookmark node id.

Parameters
parentBookmarkNodeIdnumber|undefined - The parent bookmark node id, or undefined if need reload the first level bookmark nodes.
Returns
Promise<void> - A Promise that resolves when the bookmark data is reloaded.
See also
onBookmarkChildrenReloaded
Since
10.0.0

◆ renameBookmark()

BookmarkDataService::renameBookmark ( bookmarkNodeId  ,
newTitle   
)

Renames the bookmark with the specified node id to the new title.

Parameters
bookmarkNodeIdnumber - The bookmark node id.
newTitlestring - The new title for the bookmark.
Returns
Promise<void> - A Promise that resolves when the bookmark is renamed.
See also
onBookmarkPropertiesUpdated
Since
10.0.0

◆ setColor()

BookmarkDataService::setColor ( bookmarkNodeId  ,
newColor   
)

Updates the font color of the specified node id.

Parameters
bookmarkNodeIdnumber - The bookmark node id.
newColorBookmarkTextColor - The text color of the bookmark node.
See also
onBookmarkPropertiesUpdated
Since
10.0.0

◆ setDestination()

BookmarkDataService::setDestination ( bookmarkNodeId  ,
newDestination   
)

Updates the destination for the bookmark with the specified node id.

Parameters
bookmarkNodeIdnumber - The bookmark node id.
newDestinationBookmarkDestination|undefined - The new destination information. If not specified, it will be specified according to the position and zoom ratio of the currently visible page
Returns
Promise<void> - A Promise that resolves when the destination is updated.
See also
onBookmarkPropertiesUpdated
Since
10.0.0

◆ setFontStyle()

BookmarkDataService::setFontStyle ( bookmarkNodeId  ,
style   
)

Updates the font style of the specified node ID.

Parameters
bookmarkNodeIdnumber - The ID of bookmark node.
styleBookmarkFontStyle - The font style.
See also
onBookmarkPropertiesUpdated
Since
10.0.0

Foxit Software Corporation Logo
@2024 Foxit Software Incorporated. All rights reserved.