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.

1// Instantiate a Document object.
2const licenseKey = 'Insert commercial license key here after purchase';
3const source = '/url/to/file.docx';
4
5try {
6 // If you are loading the Office file as a Blob, you need pass Blob directly
7 // as a first paramater to createDocument
8 const doc = await Core.createDocument(source, { l: licenseKey });
9 // The PDF file has been created, you can call APIs of the Document class
10} catch (error) {
11
12}

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales