darren
May 28, 2024, 12:26pm
1
PDF.js express viewer
8.7.4
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?
Yes
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
WebViewer({
path: '/pdf-viewer/public',
initialDoc: url, //'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf',
licenseKey: "REMOVED",
disabledElements: [
'toggleNotesButton',
'toolsHeader',
'selectToolButton',
'ribbons'
]
}, ele).then(instance => {
dispatch('ready', {
instance
})
}
)
Hello darren,
Thank you for reaching out,
What URL is the key attached to? The document URL should not matter
Best regards,
Tyler
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,
Tyler
Localhost is just an IP address that exists at 127.0.0.1. Any hostname that resolves to 127.0.0.1 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,
Tyler
darren
May 28, 2024, 10:52pm
9
Not to nitpick but localhost is just a common name for the loopback IP address, 127.0.0.1, 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!
Best,
Darren