Some test text!

menu

Creating Office documents using JavaScript

If you have a URL for a document, you can pass it to the WebViewer constructor or loadDocument function to open it.

WebViewer({
  ...,
  initialDoc: 'https://myserver.com/myfile.docx',
}, document.getElementById('viewer'));

// or

WebViewer(...)
  .then(instance => {
    instance.loadDocument('https://myserver.com/myfile.docx', { filename: 'myfile.docx' });
  });

linkAdvanced office loading

Creating an Office document is the same as creating a PDF document except that we need to initialize the Office worker.

// Instantiate a Document object.
const licenseKey = 'Insert commercial license key here after purchase';
const doc = await CoreControls.createDocument('/path/file.docx', { l: licenseKey });

// doc is Document instance and ready use

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

Join our live demo to learn about use cases & capabilities for WebViewer

Learn more
close