Localhost: A valid license key

Which product are you using?

PDF.js Express Viewer
PDF.js Express Version

UI version ‘8.4.1’
Core version ‘8.4.0’
Build ‘NC8xMi8yMDIyfDRkZTU3MmExYg==’
WebViewer Server false
Full API false

Detailed description of issue
{Description here}
I have the followed the setup for a viewer but no matter what I do I keep getting asked for a license key. I am using a license key as I will show in the code section.

I have taken the the zip file from the download page:

  1. Unzipped it
  2. npm install
  3. npm serve
  4. put my license key into the viewing.js file
  5. It works
  6. Move all the same code into my project and it doesn’t work because its looking for the license key.

I have also tried to do the install as shown on the manual integration getting started page:

Expected behaviour
{Provide a screenshot or description of the expected behaviour}
I am expecting the license key to be read and used for my local domain (example.test). I have created a license key for the domain example.test incase it was not recognised as a local setup.

Does your issue happen with every document, or just one?
{Answer here}
The viewer has not loaded for me as yet.

Link to document
{Provide a link to the document in question if possible}
Code snippet
{Provide a relevant code snippet}
**Note that I am using the full correct license key from the PDF.js Express page. I just removed it for the code below

<script src="/js/PDFJSExpress/lib/webviewer.min.js"></script>
<div id="viewer"></div>
    path: '/js/PDFJSExpress/lib', // path to the PDF.js Express'lib' folder on your server
    licenseKey: XXXHRt',
    initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/webviewer-demo.pdf',
  }, 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}`);

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:


Can anyone point me in the right direction on this?

Hi there,

Please try the steps posted here and let me know if you can get it resolved.

Additionally, could you provide me with the following:

  • The exact error message you are seeing
  • If possible, a link to a staging site where I can reproduce/see the issue