-
Notifications
You must be signed in to change notification settings - Fork 106
React PdfViewerComponent Only Works at Root - Routes Fail to Load PDFium Script #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Most likely is it due to use of a relative path to load the 'ej2-pdfviewer-lib' in PdfViewer.prototype.getScriptPathForPlatform This statement load the rendering path rather than the public root as documentation advices (and is preferred).
Specifically, _a.pathname throws off the path! in file: This statement: should be: var baseUrl = protocol + "//" + host |
Seems like the problem will exist for other frameworks beyond React, but I haven't tried them. |
Looks like you've provided some troubleshooting guidance. |
Note: when I change var baseUrl = protocol + "//" + host + trimmedPathname; to it works! |
Greetings from Syncfusion support. Thank you for the update. We are pleased to hear that the issue has been resolved. If you are still facing any issues, please feel free to reach out to us. Below is a sample demonstrating how to load the resource file locally. Sample refer resource file from local Regards, |
The ej2-react-pdfviewer inaccurately references pdfium when the PdfViewComponent component is used in nested routes.
For example, if the component is hosted at https://www.myapp.com/a-route/ it throws the following error:
Documentation suggests copying the folder "ej2-pdfviewer-lib" into the Public folder. But this only works if rendering the component at the project root. The component does work if copying "ej2-pdfviewer-lib" to a matching subfolder. Continuing the example above, providing "....com/a-route/ej2-pdfviewer-lib/" But surely this is not sustainable since routes can be dynamic. Besides, duplicating the code for each route is just a waste of resources.
Either is a bug or I'm missing a concept that's not documented or represented in your demo solutions.
The text was updated successfully, but these errors were encountered: