0
votes

We have implemented a WOPI host that gets called by Office Online server to serve Office documents that we store (mostly DOCX) to a web client for viewing/editing. Additionally, we need to convert these documents to PDF inside our WOPI host for other functionality.

IIUC, it is not possible to call Office Online server back from within the WOPI host to do this. Therefore we are considering using Microsoft Graph API to perform the DOCX-to-PDF conversion. AFAIK this can be done by connecting to OneDrive or SharePoint Online and uploading the document, downloading-as-PDF, deleting the document.

Does anyone know whether this can be done without involving OneDrive or SP and using Graph API to connect to the Office Online server instead? I.e. something along the lines of:

  1. We call a Graph API method to download the Word document from Office Online server as PDF.
  2. The original document in reality is served to Office Online by us via WOPI API.

I realize it is the roundabout way of doing it but we would like to leverage the MS stack for converting Office docs to PDF due to its almost flawless conversion quality. Other solutions such as conversion libraries (Apache POI+FOP or some from paid vendors) proved to be subpar in our testing.

1

1 Answers

0
votes

I don't think there's a way around OneDrive if you want to use the GraphAPI. Other people in the community take the same approach as you outlined: upload, download as PDF, delete.

You haven't mentioned what your stack is. I'm assuming Java. If you want to rely on Microsoft's implementation, it might be worth considering creating a little .NET service based on Microsoft.Office.Interop.Word.Application.