How Do I Disable Changing the Page When Tapping the Page Edges?

By default, when using the PSPDFKit.ScrollMode PER_SPREAD, tapping the edges of a page will navigate to the next or previous page. To disable this behavior, use the following workaround to ignore those touch events:

instance.contentDocument.addEventListener(
  "click",
  function (event) {
    if (
      instance.contentDocument
        .querySelector(".PSPDFKit-Viewport")
        .contains(event.target) &&
      !event.target.closest(".PSPDFKit-Page")
    ) {
      event.stopImmediatePropagation();
    }
  },
  { capture: true }
);