How Can I Create a Bookmark from an Outline Element?

One way to create a bookmark from an outline element is to manually “turn” an outline element into a bookmark using our instance.getDocumentOutline() and instance.create API:

const outlineElements = await instance.getDocumentOutline();
const outlines = outlineElements.toJS();

const bookmark = new PSPDFKit.Bookmark({
  name: outlines[0].title,
  action: new PSPDFKit.Actions.GoToAction(outlines[0].action)
});

instance.create(bookmark);

This has been tested with PSPDFKit for Web 2021.2.0.