PDF viewer is not recognizing my license key

Which product are you using?
PDF.js Express Viewer

PDF.js Express Version
|UI version|‘8.2.0’|
|Core version|‘8.2.1’|
|Build|‘MS8yMC8yMDIyfGYyZTU5NTU0YQ==’|

Detailed description of issue
The PDF Viewer loads on the page, but doesn’t open the document; it only shows a greyish overlay with the circle in the middle. The browser’s console shows the following errors:

PDFJSDocumentType.js:104 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:104 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)

I have a valid key and I entered it in my code, which is the same code as the one in the documentation for manual implementation.

I tried this first using my local environment and online, but I get the same license key error. My issue is the same as the one indicated here: Pdfjs.express 8.2.1 error on a valid License Key
But I don’t see the solution for this closed request.

Thanks,
Expected behaviour
Display PDF document

Does your issue happen with every document, or just one?
Every document

Link to document
{Provide a link to the document in question if possible}

Code snippet

  <script>
  WebViewer({
    path: '/wp-content/themes/mytheme/src/js/WebViewer/lib', // path to the PDF.js Express'lib' folder on your server
    licenseKey: 'CEAAm...MKVy',
    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>

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hey there,

Did you recently upgrade from version 8.2.0 to 8.2.1? This issue existed in 8.2.0 but was fixed in 8.2.1. The issue may be that you did not do the upgrade properly.

Let me know,
Thanks!
Logan

Hi Logan, I’ve downloaded the version available from the manual implementation page here: PDF.js Express Plus Download & Integration | Documentation

The core version shows 8.2.1 but the UI version shows 8.2.0

I tested with the PDFExpress link: https://pdfjs.express/download
core 8.2.0 ui 8.2.0 and everything works as expected.

The issue is with the PDFExpress viewer only, even though I’m downloading the latest from this link: https://pdfjs.express/download-viewer, I still get the no valid license error, and the console shows core 8.2.1 ui 8.2.0

Hey there,

Can you please try redownloading the package and making sure all assets are getting replaced with the new ones. This means completely deleting your existing version of the library and replacing it with the new one. Also, please ensure the browser is not caching old assets.

Thanks,
Logan

Hi Logan,

It finally worked after downloading the package again.

Thanks for your help.

1 Like