BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
Hi,
Im pretty excited trying to use the new standalone PdfViewer but for some reason I'm unable to get it to work. Whenever I'm trying to load a document, I get the follow error:
Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:9000/case/5/public/js/ej2-pdfviewer-lib/pdfium.js' failed to load.
at ctx.onmessage (blob:http://localhost:9000/62b6e4fe-716d-4d83-b426-427a0af17b4e:153:7)
Obviously I copied the ej2-pdfviewer-lib folder to my public/js folder as documented. So from what I understand it is this line of code in syncfusion's ejs-pdfviewer package that tries to load pdfium.js from the full history path:
importScripts(event.data.url + '/pdfium.js');
The right path should obviously be 'http://localhost:9000/js/ej2-pdfviewer-lib/pdfium.js' instead of 'http://localhost:9000/case/5/public/js/ej2-pdfviewer-lib/pdfium.js'.
Is there any easy way to fix this?
Current setup is as follow:
vue3 + quasar framework v2.12.5 (with vite)
Glad for any help.
Edit: bit of a hackish way to get it running atleast was to edit
'node_modules\@syncfusion\ej2-pdfviewer\dist\ej2-pdfviewer.min.js'
' node_modules\@syncfusion\ej2-pdfviewer\dist\ ej2-pdfviewer.umd.min.js'
' node_modules\@syncfusion\ej2-pdfviewer\dist\ej2-pdfviewer.min.js'
and replace
importScripts(e.data.url + '/pdfium.js'),
with
importScripts('/js/ej2-pdfviewer-lib/pdfium.js'),
which is for sure not a suitable solution.
Thanks
Tom
Yes its a weird behavior, I'm using quasar with vue 2x and its doing the same thing and reuses the currentURL and appends /public/js/ej2-pdfviewer-lib/pdfium.js to the current URL in the app
Example :
Docs page using pdfviewer
(standalone)
http://localhost:8084/documents/
pdf viewer tries to load
http://localhost:8084/documents/public/js/ej2-pdfviewer-lib/pdfium.js
Reports page in app using pdfviewer (standalone)
http://localhost:8084/reports/
pdf viewer tries to load
http://localhost:8084/reports/public/js/ej2-pdfviewer-lib/pdfium.js
We have confirmed that the reported issue “PDFium path issue occurred when the PDF Viewer is not on the index page” is a defect and logged the defect reported for the same. The fix for the issue will be included in our upcoming weekly NuGet release on October 18, 2023. You can track the status using the below feedback link.
Feedback link: PDFium path issue when the PDF Viewer is not on the index page | Issue Feedback
Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”
We have fixed the reported issue “Pdfium library not loading in Routed sample” and the fix for the reported issue was included in our latest weekly release v23.1.0.41. Kindly upgrade to that version to get the issue resolved.
Also, we have added a new API for adding the annotations and we have provided guidelines to follow and a sample has been provided for reference.
Load libraries from resourceUrl
Create Angular Pdfviewer sample:
Resolve library path issue:
|
Sample: AngularSample_resourceUrl.zip
Regards,
Visvesvar K V