Add logging for page changes and total pages in PSPDFKit

Added a .then() handler to loadPSPDFKit to log the active page number on page change events and log the total number of pages after loading. This aids in debugging and tracking user navigation within the document.
This commit is contained in:
2026-01-19 16:57:34 +01:00
parent 7495e062a9
commit 2606066103
2 changed files with 11 additions and 2 deletions

View File

@@ -16,7 +16,16 @@
isEditableAnnotation: function (annotation) {
return !(annotation.isSignature || annotation.description === 'FRAME')
},
});
}).then((instance) => {
instance.addEventListener('viewState.currentPageIndex.change', (pageIndex) => {
console.log('Active page:', pageIndex + 1)
})
const totalPages = instance.totalPageCount || 0
console.log('All pages loaded, total pages:', totalPages)
return instance
})
}
const allowedToolbarItems = [