Custom UI without global/window objects

WebViewer Version: 10.1.1

Do you have an issue with a specific file(s)? no
Can you reproduce using one of our samples or online demos? n/a
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? no
Is your issue related to annotations? no

Please give a brief summary of your issue:

Is it possible to create a custom UI without importing webviewer-core.min.js into the Window and polluting the entire page? Our application is a SPA and I’d prefer not to load all of this code until it is needed.

It would be nice for something like this to be possible:

// Import/use Core from a module instead of the Window...
import { Core } from '@pdftron/webviewer';

Core.setWorkerPath('/pdftron');
const documentViewer = new Core.DocumentViewer();
documentViewer.setViewerElement(myElement);
documentViewer.loadDocument('test.pdf');

Hello,

Right now we don’t have an option like that but we totally agree this would be better and it is in our plans to add that. For now, you could just wait to append the script tag to the page until you need as you can see here → javascript - How to add DOM element script to head section? - Stack Overflow.

Best,
Dandara Navarro