How to change initialDoc and reload viewer?

How to change initialDoc and reload viewer instance with pure Javascript?

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:

Hey,

To change the document you do not need to reload the instance (we actually do not recommend reloading the instance at all).

To change documents after the viewer is already loaded, you can use the instance.UI.loadDocument API:


WebViewer({
   path: '/public/express',
 }, element).then(instance => {

   // ...Somewhere in your code

  // Load file via URL
  instance.loadDocument('http://yourwebsite.com/document.pdf')

  // Load file via Blob
  instance.loadDocument(myBlob)

});

More details can be found in our documentation in the “Open a document” section.

Thanks!
Logan