Opening MS Office documents using JavaScript
Opening an MS Office document is the same as creating a PDF document except that we need to initialize the Office worker.
Last updated
Was this helpful?
Was this helpful?
// Instantiate a Document object.
const licenseKey = 'YOUR_LICENSE_KEY';
const source = '/url/to/file.docx';
try {
// If you are loading the Office file as a Blob, you need pass Blob directly
// as a first paramater to createDocument
const doc = await Core.createDocument(source, { l: licenseKey });
// The PDF file has been created, you can call APIs of the Document class
} catch (error) {
}// Instantiate a Document object.
const licenseKey = 'YOUR_LICENSE_KEY';
const source = '/url/to/file.docx';
try {
// If you are loading the Office file as a Blob, you need pass Blob directly
// as a first paramater to createDocument
const doc = await CoreControls.createDocument(source, { l: licenseKey });
// The PDF file has been created, you can call APIs of the Document class
} catch (error) {
}