The active licence key is not working

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!

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!

Can you confirm that the key is being used on the same domain that it is registered to?

Logan

I use it on localhost and my domain is set to “http://localhost:3000/
Should I put something else to use it in development mode?

2 Likes

I have the same problem. My Free PDF.js Express Viewer keys is registred to localhost, but not run.

I have a localhost server running but i’m actually using it in NWJS and not the localhost and its not working either, i’m getting the same errors as the guys above. Will localhost always be needed to run the free version?

Hey @user25

I do not understand what you mean by “I have a localhost server running but i’m actually using it in NWJS and not the localhost and its not working either”.

The license key domain should point to the domain of your production application - you do not need to set it to localhost. Valid license keys will always work on localhost for development purposes, regardless of the domain set.

Thanks,
Logan