Pdfjs.express viewer asking for license key with one provided

PDF.js express viewer


I have added the license key but the console is saying I still need to provide one and the document does not load.

Expected behaviour
Based on the docs it should be removed with the key.

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

Link to document
The documents are loaded through S3 signed URLs so they will expire by the time they’re viewed by you.

Code snippet
const WebViewer = (await import(‘@pdftron/pdfjs-express-viewer’)).default

    path: '/pdf-viewer/public',
    initialDoc: url, //'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf',
    licenseKey: "REMOVED",
    disabledElements: [
  }, ele).then(instance => {
    dispatch('ready', {

Hello darren,

Thank you for reaching out,
What URL is the key attached to? The document URL should not matter

Best regards,

This is running on localhost with a companyname.app.localhost:5173. Our app uses this hostname configuration where “companyname” is a unique host per company.

In this case it’s sprkl.app.localhost:5173.

Hello darren,

That does not appear to be a localhost address, which means .app is the actual domain for how you are running the application.

Best regards,

Localhost is just an IP address that exists at Any hostname that resolves to is localhost.

Are you saying that I need to recreate a custom license key for any localhost hostname that is not specifically “localhost”? If so, I’ll try that.

Or perhaps if you don’t care about the hostname I can just resolve to a mega.hr hostname locally.

Hello darren,

Localhost is a valid address because it is a loopback, however “companyname.app.localhost:5173” is not the same as just “localhost”

In “companyname.app.localhost:5173”, .localhost is the TLD, and not mapped to a loopback by default on machines (unless you have set this manually)

Best regards,

Not to nitpick but localhost is just a common name for the loopback IP address,, which is the local machine address. “Localhost” itself as a hostname is arbitrary.

Anyways, I get what you’re saying as it relates to the product. I’ll just add a localhost host record for the domain we have registered with the key I think that should work.

I appreciate your time!