For the complete documentation index, see llms.txt. This page is also available as Markdown.

Open and Load Blob Format Documents Using JavaScript

Opening a document in WebViewer from Blob

If your document is already in Blob format you can pass the Blob object directly to loadDocument function.

WebViewer(...)
  .then(instance => {
    // `myBlob` is your blob data which can come
    // from sources such as a server or the filesystem
    instance.UI.loadDocument(myBlob, { filename: 'myfile.pdf' });

    const { documentViewer } = instance.Core;
    documentViewer.addEventListener('documentLoaded', () => {
      // perform document operations
    });
  });
WebViewer(...)
  .then(instance => {
    // `myBlob` is your blob data which can come
    // from sources such as a server or the filesystem
    instance.loadDocument(myBlob, { filename: 'myfile.pdf' });

    const { docViewer } = instance;
    docViewer.on('documentLoaded', () => {
      // perform document operations
    });
  });

Loading Options

WebViewer provides various options to load a document. Whether you are loading a document through the initialDoc option in the constructor or calling loadDocument after mounting, you can always provide options to load your document.

Last updated

Was this helpful?