javascriptms-wordoffice-jsoffice-addinsword-web-addins

Convert PDF to Docx using MS "Add In" Office.js SDK


The standard approach for Office automation has been to program against COM interfaces (e.g. Office Primary Interop Assembly), and this only works on a Windows OS. Instead, I am interested in using the new Office "Add In" technology, which replaces COM with Office.js and is cross-platform.

In particular, I want to use this new Office.js automation technology to convert a PDF to Docx. Is this possible? Does anyone have an example?


Solution

  • I am interested in using the new Office "Add In" technology, which replaces COM with Office.js and is cross-platform.

    You are on the wrong avenue. The Office JavaScript API is not a replacement for the COM technology. I bet COM will exist with us and nothing will replace it in near future. I'd say Office JS API is an alternative way of developing add-ins for MS Office applications where you could support multiple supports. But the API is under active development at this time which means there is no feature parity between them atm.

    In particular, I want to use this new Office.js automation technology to convert a PDF to Docx. Is this possible? Does anyone have an example?

    The Office JavaScript API doesn't provide anything for that. Office add-in work under the context of currently opened document only. The best what you could do is to get a string (base64) which represents the document and pass it to any web service (backend side) for converting.