Disable the Context Menu in PSPDFKit

There might be cases where you want to disable right-clicking inside the PSPDFKit inline frame. You can do this by using the following code:

PSPDFKit.load(options).then((instance) => {
  // Disable the context menu.
  instance.contentDocument.addEventListener("contextmenu", (event) =>
    event.preventDefault()
  );
});

The code above uses instance.contentDocument to access the viewer’s document object.

This has been tested with PSPDFKit for Web 2020.1.2