Which product are you using?
PDF.js Express Viewer. From the package.json
file:
"name": "@pdftron/pdfjs-express-viewer",
"description": "PDFJS Express",
"version": "8.7.5",
"main": "lib/webviewer.min.js",
PDF.js Express Version
|UI version|'8.7.0'|
|---|---|
|Core version|'8.7.5'|
|webviewer.min.js|'8.7.5'|
|Build|'Ny80LzIwMjR8MzMxOTBmNGM5YQ=='|
|WebViewer Server|false|
|Full API|false|
Detailed description of issue
Strictly using the example code in the manual integration section (PDF.js Express Viewer Download & Integration | Documentation), the js console constantly complains about the license key:
PDFJSDocumentType.js:118 A license key is required to use the view only build of PDF.js Express. Get your free license key at https://pdfjs.express/profile (account required)
PDFJSDocumentType.js:119 Uncaught (in promise)
Error: A license key is required to use the view only build of PDF.js Express. Get your free license key at https://pdfjs.express/profile (account required)
at error (PDFJSDocumentType.js:119:1)
at PDFJSDocumentType.js:2697:417
The viewer itself loads. After a second, however, it goes gray with a circle in the middle. This is on a server that’s in a subdomain of the one the license key has been issued for.
Expected behaviour
Expected behavior is that the PDF loads in the window and no license key errors in the console.
Does your issue happen with every document, or just one?
All documents, even the sample ones provided in the documentation’s sample code.
Link to document
Code snippet
<div id='viewer' style="width:1024px;height:600px;margin:0 auto"></div>
<script>
WebViewer({
path: '/js/pdfjsexpress/lib',
licenseKey: '--removed--',
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>