PDF.js Express Version
Detailed description of issue
- I went through this tutorial and followed all steps: PDF.js Express Viewer Download & Integration | Documentation
- When I click F12 and use the developer’s tool, I see these errors:
a. webviewer-ui.min.js:239
[WebViewer] Version Mismatch: UI requires Core version 8.2.0 and above.
b. webviewer-ui.min.js:68
react-i18next:: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.
Expected behaviour
After following the tutorial, there should be no warning messages in the developer’s tools.
Code snippet
<script>
WebViewer({
path: '/pdf9/lib', // path to the PDF.js Express'lib' folder on your server
licenseKey: 'mXXXXX',
initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/webviewer-demo.pdf',
// initialDoc: '/path/to/my/file.pdf', // You can also use documents on your server
}, document.getElementById('viewer'))
.then(instance => {
// now you can access APIs through the WebViewer instance
const { Core, UI } = instance;
// adding an event listener for when a document is loaded
Core.documentViewer.addEventListener('documentLoaded', () => {
console.log('document loaded');
});
// adding an event listener for when the page number has changed
Core.documentViewer.addEventListener('pageNumberUpdated', (pageNumber) => {
console.log(`Page number is: ${pageNumber}`);
});
});
</script>