Do you have an issue with a specific file(s)?
initialState.js:2286:52
Can you reproduce using one of our samples or online demos?
No
Are you using the WebViewer server?
No
Does the issue only happen on certain browsers?
No
Is your issue related to a front-end framework?
Yes
Is your issue related to annotations?
No
Please give a brief summary of your issue:
I have been trying to integrate apryse webviewer widget with the version of 11.5.0 in one of the mendix project.
The integration of this widget is tested in the following studio pro versions - 9.24.21, 9.24.35 and 10.18.7, it runs well without any issues.
But when integrating the same in another existing mendix project with the studio pro version 9.24.21, I ended up receiving the following error.
mxui.js?638863608621449845:66 [Client] TypeError: Cannot read properties of undefined (reading ‘VIEW_ONLY’)
at Module. (initialState.js:2286:52)
at o (bootstrap:63:22)
at bootstrap:198:10
at webviewer-ui.min.js:1:2097
Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
Please provide a link to a minimal sample where the issue is reproducible:
Hello, I’m AiRon, an automated tech support bot While you wait for one of our customer support representatives, I can help you with your question.
It seems you’re encountering a TypeError related to an undefined property VIEW_ONLY when integrating Apryse’s WebViewer in a Mendix project. This error typically indicates that the object or module you’re trying to access hasn’t been properly initialized or imported.
Some things you can try:
Ensure that all necessary dependencies are correctly installed and available in your project. Sometimes, missing or incorrectly linked libraries can cause such errors.
Double-check the configuration files to ensure that all paths and module dependencies are correctly specified.
Look at the initialization sequence of the WebViewer in your project. Make sure it initializes correctly before any properties are accessed.
Compare the working project setup with the one experiencing issues to identify any discrepancies in configuration or file structure.
Review any customizations in the Mendix project that might affect the WebViewer’s initialization or configuration.
we are upgrading the widget (PDFTron) from v5.2.5 to v11.5.0
The widget is not rendering in the page and in the pop-up as well. But in the page, when we do hard refresh it started rendering and we can perform all the actions inside the widget.
If you are upgrading from v5 to 11, be aware that default mode switched from Iframe to Webcomponent, this could create some issue, you could try to see if it’s resolved by doing:
viewer.Iframe(
{
path: “/resources/lib”,
Be aware that the default UI mode also switched from legacy to modular, you might have some deprecrated API’s in your code, here is a guide showing how to migrate from legacy to UI:
Or you could easily switch back to legacy adding this option to your constructor:
ui: 'legacy'
Let us know if any of those solutions are working for you!
Following your recommendation, we set ui: 'legacy', which successfully resolved the rendering issue on both desktop and iPad browsers.
However, we’re still facing one issue related to saving annotations. Please find the scenario below:
The user opens a document using the WebViewer widget inside a modal popup.
Annotations are added.
The “Save” option is clicked.
The modal popup is closed — here’s the issue: if the user closes the modal immediately (within the same second) after the save action completes, the annotations are not saved. However, if the user waits for 3 or more seconds before closing the modal, the annotations are saved correctly.
Could you please advise if there’s a recommended approach or workaround to ensure annotations are reliably saved, even when the modal is closed immediately after saving?
We were able to handle the save functionality using a custom mechanism.
Using JavaScript, we invoked the save action from the WebViewer widget via a custom button, allowing us to trigger additional processes for saving the annotated content.
However, we’ve now encountered an issue when trying to view PDF files with a .html extension. This was working fine in version 5.2.5 but seems to be failing in the current setup.
Could you please advise on how to resolve this issue?
The internal issue with the file server has been resolved. However, we’re now facing another challenge:
Issue:
Previously annotated content (using the freehand tool) is being erased when the file is edited. In the previous version, annotations added by one user could not be erased by another.
Scenario:
User 1: Edits the file by adding annotations and saves it.
User 2: Later edits the file by commenting or adding additional annotations.
Expected Behavior: Only the annotations added by User 2 should be modifiable, and annotations from User 1 (or any other user) should remain protected from being erased.
Could you please advise on how we can prevent annotations from being erased in the latest version, as it was not allowed in the older version?
Could you give a bit more information on how the annotations are saved?
Are you exporting the XFDF and then importing it back when the second user is loading the file?
If that’s the case, before exporting the annotations, you can set them as read-only.
This way, when they are imported back the next time, it will not be possible to edit or delete those annotations.