Global Webviewer Function

Product: PDFTron

Product Version: 8.9

Please give a brief summary of your issue:
I feel this is probably a very basic gap in my pdftron knowledge, but I’ve read a bit on about a global webviewer function. I have searched the docs and the best I could find was getInstance here but the documentation doesnt match what the SDK docs shows and I’ve not been able to use this. It doesn’t seem to import as either a named export as the documentation indicates (at least not in typescript)

What is this global webviewer function and how do I use it? I believe this could help me out rather than passing the functions around as parameters

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:

Hi dcheli!

The WebViewer global function is basically how you instantiate WebViewer, for example in React you can:

import WebViewer from '@pdftron/webviewer';

WebViewer({...},(instance)=> {...})

It really depends how you import WebViewer into your application, another would be using window.instance.Core...
if the instance is attached to the window.

getInstance gets the instance of WebViewer that is instantiated, if there are multiple it takes in an element and returns the WebViewer instance associated with that element.

Let me know if that clears anything up or if you have any other questions.

Best regards and happy holidays,
Tyler Gordon
Web Development Support Engineer
PDFTron

Thanks and that makes sense. Happy New Year!