Open a document from ArrayBuffer
Opening a document from ArrayBuffer
If your document is already in ArrayBuffer format you can convert the ArrayBuffer object to a Blob and then pass resulting Blob directly to loadDocument function.
WebViewer(...)
.then(instance => {
// `arrayBuffer` is your buffer data which can come
// from sources such as a server or the filesystem
instance.UI.loadDocument(arrayBuffer, {
// You need to specify either the file name of extension so
// that WebViewer knows how to interpret the data
filename: 'myfile.docx'
// You can also change the InitialMode with WebViewer 11
// initialMode: WebViewer.Modes.DOCX_EDITOR,
});
const { documentViewer } = instance.Core;
documentViewer.addEventListener('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?