Remove Bookmarks in PDFs Using JavaScript

With PSPDFKit, you can delete bookmarks using the instance.delete method. The example below shows how to first retrieve bookmarks from a document using the instance.getBookmarks method, and then delete the first bookmark:

async function deleteFirstBookmark() {
  const bookmarks = await instance.getBookmarks();
  const firstBookmark = bookmarks.get(0);

  if (firstBookmark) {
    await instance.delete(firstBookmark.id);
  }
}