Avoid resetting page settings on loadDocument

WebViewer Version: 8.5.0

Do you have an issue with a specific file(s)?
No

Can you reproduce using one of our samples or online demos?
Yes

Are you using the WebViewer server?
No

Does the issue only happen on certain browsers?
No; General issue

Is your issue related to a front-end framework?
Yes

Is your issue related to annotations?
Yes; Tool mode changes/resets back to (unknown) default.

Please give a brief summary of your issue:
Whenever we reuse the already initialized web-viewer instance and let the user load a new document all previously set settings get resetted.
Opened panels, page transition, page layout selected annotation tool gets resetted.
I did not find any possibility to disable this behaviour and/or overwritet it to my defaults.

Please describe your issue and provide steps to reproduce it:

  • Open JS Large Files Viewer Demo | PDFTron WebViewer
  • Select the “pan tool”
  • Select a different page transition, page layout
  • Open the left panel
  • Open the comments panel
  • Change to another document
  • All previously set uset settings get resetted

Please provide a link to a minimal sample where the issue is reproducible:

Thanks for your help in advance.

Regards,
Benjamin

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Thanks “Ron”, the automated suggestions do not solve and/or address my issue.

Hi Benjamin,

Unfortunately, we currently don’t have an API to avoid resetting the page settings after loading new document. You would need to achieve this by customizing the Webviewer UI.

The Webviewer UI is an open-source project that could be accessed at GitHub - PDFTron/webviewer-ui: WebViewer UI built in React.
You could prevent the resetting by changing the code in the onDocumentUnloaded event: webviewer-ui/onDocumentUnloaded.js at 8.7 · PDFTron/webviewer-ui · GitHub. By removing the leftPanel from the array inside actions.closeElements, this should prevent the left panel from closing after you load a new document.Similar configurations could be applied to the elements that you would like to keep after loading a new document.

You could also check the guide for UI customization at: PDFTron Systems Inc. | Documentation

Thank you.

1 Like

I was afraid I had to compile and maintain the UI by myself - anyways thanks for your quick response.
That solved my issue.