| FoxitPDFSDKforWeb v11.0.5 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
BookmarkDataService Class Reference
PDFViewCtrl » bookmark

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

  options | AddBookmarkOptions - 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

  bookmarkNodeId | number - The bookmark node id.
  parentBookmarkNodeId | number|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

  destBookmarkNodeId | number - 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

  bookmarkNodeId | number|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

  bookmarkNodeId | number - 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

  bookmarkNodeId | number - 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

  srcBookmarkNodeId | number - The source bookmark node id.
  srcParentBookmarkNodeId | number|undefined - The source parent bookmark node id.
  destBookmarkNodeId | number|undefined - The destination bookmark node id.
  destParentBookmarkNodeId | number|undefined - The destination parent bookmark node id.
  relationship | BookmarkRelationship - 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

  destBookmarkId | number - The destination bookmark node id.
  destParentBookmarkId | number|undefined - The parent id of the destination bookmark node.
  relationship | BookmarkRelationship - 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

  bookmarkNodeId | number - 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

  parentBookmarkNodeId | number|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

  bookmarkNodeId | number - The bookmark node id.
  newTitle | string - 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

  bookmarkNodeId | number - The bookmark node id.
  newColor | BookmarkTextColor - 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

  bookmarkNodeId | number - The bookmark node id.
  newDestination | BookmarkDestination|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

  bookmarkNodeId | number - The ID of bookmark node.
  style | BookmarkFontStyle - The font style.

See also
  onBookmarkPropertiesUpdated

Since
  10.0.0

@2025 Foxit Software Incorporated. All rights reserved.