Which product are you using?
PDF.js Express Viewer
PDF.js Express Version
Core Version- 8.4.0,
UI Version - 8.4.1
Detailed description of issue
This issue is happening randomly & the license key API is not getting called most of the times, some time it calls the API some times not & the result of that is the document is not loading, see the attached image below. This is so annoying. see the Screenshot below
This error happens when a license key is not provided at all to the PDF.js Express constructor. Your screenshot shows you passing a key so my suspicion is that either you are seeing a cached version of your page where you don’t pass a key, or you are calling the constructor elsewhere in your code.
Please try the following
Clearing your cache
Reinstalling PDF.js Express Viewer and making sure to properly replace all the static assets (delete the old ones and then reinstall)
Make sure you aren’t accidentally calling the constructor elsewhere
Make sure all the assets are being loaded correctly (check the network tab for any 404s)
If none of these fixes it, providing a link to this environment so I can test it myself would be helpful.
Hello Logan, Thanks for the insight. We are calling the page every time Not cached version & the constructor is being called every time otherwise how . So 'if I refresh the page 5 times 3 times the license error is coming & 2 times its loading correctly. Please help me.
Hi Logan, due to HIPAA compliance, I won’t be able to provide you the Link, I can only send you walkthrough video link. Will that work?
Please suggest me some solution. This thing is Random
A video walkthrough won’t be helpful as I need to be able to access the network tab and see whats going on.
I am fairly confident that this is an issue in your code somewhere and not an issue with our library.
Some things you can check for me:
When the license does not get triggered and you see the error, are you able to inspect the source code in the developer console and confirm that the license key is set correctly?
When the license does not get triggered and you see the error, do you see any network requests in the network tab going to auth.pdfjs.express? If so, can you export those requests and send them to me?
Can you confirm that ‘webviewer.min.js’ is not getting loaded twice in the network tab?
The API is only called when a document is loaded for the first time. Do you only see the error when loading a certain kind of document? In the code you provided in the original message you have two code paths for UI.loadDocument, do you see the error for both of those code paths?
Hi, If I keep refreshing the same page again & again. Out of 10 refresh 6 times its failing & 4 times its successful. Lets say I open the page for the first time the viewer didn’t load but if I refresh the page it loads perfect. If I again refresh it may load or may not by throwing License error. its Random behavior. Hope you understand.
I unfortunately do not have enough information to help at the moment. I will either need access to your environment or consistent steps to reproduce. Without either of those I cannot help any further.
Let me know if you are able to uncover anything else.