Detailed description of issue
We are seeing the following error without any code changes on our side:
Uncaught (in promise) Error: Full version of PDFNetJS has not been loaded. Please pass the "fullAPI: true" option in your WebViewer constructor to use the PDFNet APIs.
at Object.get (webviewer-core.min.js:2408:73)
at Proxy.toString (<anonymous>)
at isPlainObject (vue.esm.js?4b29:55:1)
at observe (vue.esm.js?4b29:967:1)
at defineReactive (vue.esm.js?4b29:991:1)
at new Observer (vue.esm.js?4b29:941:1)
at observe (vue.esm.js?4b29:972:1)
at defineReactive (vue.esm.js?4b29:991:1)
at new Observer (vue.esm.js?4b29:941:1)
at observe (vue.esm.js?4b29:972:1)
Trying to workaround it by following the instructions I get this:
Uncaught (in promise) Error: "fullAPI" is not a valid constuctor option for PDF.js Express. Please make sure you are referring to the proper documentation (https://pdfjs.express/documentation)
at c.WebViewer._getHTML5OptionsURL (webviewer.min.js:1:17886)
at c.WebViewer._createHTML5 (webviewer.min.js:1:20498)
at c.WebViewer._createViewer (webviewer.min.js:1:14742)
at c.WebViewer._create (webviewer.min.js:1:13020)
at c.WebViewer.create (webviewer.min.js:1:12797)
at new c.WebViewer (webviewer.min.js:1:12494)
at webviewer.min.js:1:26794
at new Promise (<anonymous>)
at v (webviewer.min.js:1:25339)
at VueComponent.loadWebViewer (UiPdfViewer.vue?bc8e:75:1)
I am unsure how this is caused without code changes on our side but this is very worrying and hope there is a quick fix.
Expected behaviour
The PDF.js Express viewer to work.
Does your issue happen with every document, or just one?
Every.
Can you share your WebViewer constructor? there shouldn’t be a ‘fullAPI’ option for pdf.js express.
Thank you in advance.
Best regards,
Kevin Kim
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here
If you are still experiencing this issue, can you please share a minimal runnable sample project so we can reproduce on our end?
Thank you in advance.
Best regards,
Kevin Kim
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here
So this is interesting, and thanks for your comments because that helped with debugging here.
I already couldn’t understand what was going because I doubted it could be related to a remote issue.
The problem here is that we store the WebViewer instance in a Vue component property.
However, it seems that recent changes in Vue or some other support library causes some code to be executed in the WebViewer instance. I would never have expected this to happen and I also haven’t totally locked down what is even happening or why.
We ended up fixing it by making sure we store the WebViewer instance non-reactive (was not needed to be reactive in the first place but that’s just how Vue works).
I don’t have the bandwidth to extract the meaninful parts from our environment to a small enough example unfortunately at this moment, sorry for that. But hopefully this thread helps any other Vue user when they run into this.
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here
And later in our code we did this.webviewer = instance after we instantiated the webviewer. This causes the this.webviewer to be reactive, so our simple fix was to remove webviewer from the data() which prevents that from happending. We still do this.webviewer = instance so we can reference it but don’t pre-fill it in our data().