Which product are you using?
PDF.js Express Viewer
PDF.js Express Version
“8.1.1”
Detailed description of issue
I have active key licence for PDF.js Express Viewer but I my console it still says the error message:
A license key is required to use the view only build of PDF.js Express. Get your free license key at PDF.js Express (account required)
I think the fact that the document is not loading is because my licence key is not recognised as being valid.
Expected behaviour
Does your issue happen with every document, or just one?
It does on every document.
Code snippet
import React, { useRef, useEffect } from "react";
import WebViewer from "@pdftron/pdfjs-express-viewer";
const OpenPDF = () => {
const viewer = useRef(null);
useEffect(() => {
WebViewer(
{
path: '/webviewer/lib',
initialDoc: 'https://bgrmihailsturdza.files.wordpress.com/2014/02/rebreanu-liviu-ion-i-cartea.pdf',
licenseKey: '//'
},
viewer.current,
).then((instance) => {
// now you can access APIs through the WebViewer instance
const { Core } = 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}`);
});
});
}, []);
return (
<div className="App">
<div className="header">React sample</div>
<div className="webviewer" ref={viewer}></div>
</div>
);
};
export default OpenPDF;
Thank you!