Please describe your issue and provide steps to reproduce it:
Each time you load a new document, PDFTron removes all children from the container that contains the rendered document (set by documentViewer.setViewerElement(viewerElement)).
Therefore, you have to add custom elements manually every time after loading new documents.
Thank you for contacting us regarding Webviewer.
To further investigate the issue, could you provide the following information?
- Could you elaborate more about what you want to achieve?
- Minimal project/code snippet to reproduce the issue
- What customer elements are you adding?
- Other related information.
I have a setup similar to this:
So there is no WebViewer instance. I like do use PDFTron without the iFrame and build my own UI.
In the DIV element that is used for documentViewer.setViewerElement() I have a popup component for selected annotations. All good until I load a new document. When you inspect the DOM you will see, that loadDocument() deletes all children from the div that is used by setViewerElement().
loadDocument is designed to unload old document and render the new one, so the content within the viewer document will be wiped.
If you want to create custom popup component, you may have to create it outside of the viewer div. You can convert the coordinates between the viewer and PDF to append the popup to the right place in the viewer. Please check the guide: PDFTron Systems Inc. | Documentation
if the method is designed to delete all elements from a node (even those not created by PDFTron) it should at least be documented in the API.
Thank you for the suggestion.
We will add that to our backlog if it fits our roadmap in the future.