| FoxitPDFSDKforWeb v11.0.6 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
BookmarkUIService Class Reference
UIExtension » bookmark

Bookmark service for manipulating bookmark data at the UIExtension level. Different from BookmarkDataService, the BookmarkUIService also updates the UI and supports undo-redo. More...

## Public Member Functions
Promise< number > | addBookmark (options)
| Creates a new bookmark node and inserts it into the bookmark tree component. This operation can be undone if the `undo-redo` addon is loaded in PDFUI. More...
void | cutBookmark (bookmarkId)
| Marks a bookmark node as cut and adds the `fv__ui-bookmark-tree-cut-node` class to its DOM node. More...
Promise< void > | deleteBookmark (bookmarkId)
| Delete the bookmark data node and delete the corresponding tree node. This operation can be undone if the `undo-redo` addon is loaded in PDFUI. More...
number undefined | getCurrentActiveBookmarkId ()
| Retrieves the ID of the currently active bookmark. More...
void | onSwitchCurrentBookmarkNode (callback)
| This event is triggered when a user manually selects a bookmark or when the document navigates to a bookmark due to page turning.. 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...
Promise< void > | renameBookmark (bookmarkId, newTitle)
| Renames a bookmark node. This operation can be undone if the `undo-redo` addon is loaded in PDFUI. More...
Promise< void > | setColor (bookmarkId, newColor)
| Updates the text color of a bookmark node. More...
Promise< void > | setDestination (bookmarkId, newDestination)
| Updates the destination of a bookmark node. More...
Promise< void > | setFontStyle (bookmarkId, newFontStyle)
| Updates the font style of a bookmark node. More...

## Detailed Description

Bookmark service for manipulating bookmark data at the UIExtension level. Different from BookmarkDataService, the BookmarkUIService also updates the UI and supports undo-redo.

See also
  BookmarkDataService
  PDFUI.getBookmarkUIService

Since
  10.0.0

## Member Function Documentation

## ◆ addBookmark()

Promise<number> BookmarkUIService::addBookmark | ( | options |  | ) |

Creates a new bookmark node and inserts it into the bookmark tree component. This operation can be undone if the `undo-redo` addon is loaded in PDFUI.

Parameters

  options | AddBookmarkOptions - Options for creating the new bookmark.

Returns
  Promise<number> - A promise that resolves with the new bookmark ID or rejects if failed.

Since
  10.0.0

## ◆ cutBookmark()

void BookmarkUIService::cutBookmark | ( | bookmarkId |  | ) |

Marks a bookmark node as cut and adds the `fv__ui-bookmark-tree-cut-node` class to its DOM node.

Parameters

  bookmarkId | number - The bookmark ID.

Returns
  void -

See also
  BookmarkDataService.cutBookmark
  BookmarkDataService.pasteCutBookmark

Since
  10.0.0

## ◆ deleteBookmark()

Promise<void> BookmarkUIService::deleteBookmark | ( | bookmarkId |  | ) |

Delete the bookmark data node and delete the corresponding tree node. This operation can be undone if the `undo-redo` addon is loaded in PDFUI.

Parameters

  bookmarkId | number - The bookmark ID to delete.

Returns
  Promise<void> - A promise that resolves when the deletion is successful or rejects if failed.

Since
  10.0.0

## ◆ getCurrentActiveBookmarkId()

number undefined BookmarkUIService::getCurrentActiveBookmarkId | ( |  | ) |

Retrieves the ID of the currently active bookmark.

Returns
  number|undefined - The current active bookmark ID.

Since
  10.0.0

## ◆ onSwitchCurrentBookmarkNode()

void BookmarkUIService::onSwitchCurrentBookmarkNode | ( | callback |  | ) |

This event is triggered when a user manually selects a bookmark or when the document navigates to a bookmark due to page turning..

Parameters

  callback | (last:BookmarkData,current:BookmarkData)=>void -

Returns
  void -

Since
  10.0.0

## ◆ pasteCutBookmark()

Promise<void> BookmarkUIService::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> -

Since
  10.0.0

## ◆ renameBookmark()

Promise<void> BookmarkUIService::renameBookmark | ( | bookmarkId | ,
|  | newTitle |
| ) |  |

Renames a bookmark node. This operation can be undone if the `undo-redo` addon is loaded in PDFUI.

Parameters

  bookmarkId | number - The bookmark ID.
  newTitle | string - The new title for the bookmark.

Returns
  Promise<void> - A promise that resolves when the renaming is successful or rejects if failed.

Since
  10.0.0

## ◆ setColor()

Promise<void> BookmarkUIService::setColor | ( | bookmarkId | ,
|  | newColor |
| ) |  |

Updates the text color of a bookmark node.

Parameters

  bookmarkId | number - The bookmark ID
  newColor | string - The new color for the bookmark.

Returns
  Promise<void> - A promise that resolves when the setting is successful or rejects if failed.

Since
  10.0.0

## ◆ setDestination()

Promise<void> BookmarkUIService::setDestination | ( | bookmarkId | ,
|  | newDestination |
| ) |  |

Updates the destination of a bookmark node.

Parameters

  bookmarkId | number - The bookmark ID
  newDestination | BookmarkDestination - The new destination infomation for the bookmark

Returns
  Promise<void> - A promise that resolves when the setting is successful or rejects if failed.

Since
  10.0.0

## ◆ setFontStyle()

Promise<void> BookmarkUIService::setFontStyle | ( | bookmarkId | ,
|  | newFontStyle |
| ) |  |

Updates the font style of a bookmark node.

Parameters

  bookmarkId | number - The bookmark ID.
  newFontStye | BookmarkFontStyle - The new font style for the bookmark.

Returns
  Promise<void> - A promise that resolves when the setting is successful or rejects if failed.

@2025 Foxit Software Incorporated. All rights reserved.