convert word document to pdf and render via office.com or web api

David McDivitt 206 Reputation points
2022-01-27T20:59:08.03+00:00

My organization uses Microsoft extensively, Sharepoint Online, Office 365, etc. I want a web application to render Word and Excel documents by converting to PDF. I read where a page at office.com can be opened, including the URL of a document, and it will be rendered. Can someone please elaborate on this functionality? The documents are blobs on an SQL Server. Ideally I would like to use HTTP post to send documents to a web address, have it render, and stay within the organization/Microsoft security environment.

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,684 questions
Office Open Specifications
Office Open Specifications
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Open Specifications: Technical documents for protocols, computer languages, standards support, and data portability. The goal with Open Specifications is to help developers open new opportunities to interoperate with Windows, SQL, Office, and SharePoint.
127 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rob Windsor 1,961 Reputation points
    2022-01-28T23:02:42.123+00:00

    You could use the Microsoft Graph to save the document to the user's OneDrive, convert the document to PDF, and then delete the original. The API used to convert the format of a file in OneDrive is Convert Content. The response from this request includes the URL to the converted document.

    2 people found this answer helpful.
    0 comments No comments

  2. Tom Jebo 1,991 Reputation points Microsoft Employee
    2022-01-28T18:33:25.547+00:00

    Hi @David McDivitt ,

    What you are referring to may be WOPI. The WOPI protocol enables office web apps (Word, PowerPoint and Excel) to view and edit documents with in a 3rd party web app page. This is useful in situations where you can manage the documents i.e. a file server host application. It sounds like your SQL Server blob solution would fit this scenario.

    Are you planning to use the Microsoft cloud provided Office web apps? If so, in order to use a solution with the WOPI protocol, you would need to work with our Cloud Storage Partner Program, information is here:
    https://video2.skills-academy.com/en-us/microsoft-365/cloud-storage-partner-program/online/

    If you are able to use an on-premises solution and can deploy Office Online Server in your enterprise, then you can implement this independently. There is information about deploying OOS here:
    https://video2.skills-academy.com/en-us/officeonlineserver/office-online-server

    You can read about the WOPI protocol here:
    https://video2.skills-academy.com/en-us/openspecs/office_protocols/ms-wopi/6a8bb410-68ad-47e4-9dc3-6cf29c6b046b - this is the technical specification
    https://video2.skills-academy.com/en-us/microsoft-365/cloud-storage-partner-program/rest/ - this is a helpful reference for cloud integration

    There's also helpful information in the first link for both cloud and on-premises integrations, including a reference to a sample host implementation on github which I've linked here:
    https://github.com/Microsoft/Office-Online-Test-Tools-and-Documentation/tree/master/samples/SampleWopiHandler

    If you go the on-premises route, questions about the [MS-WOPI] technical specification can be direct to this Q&A forum.
    If you go the cloud route, there is a yammer group available to participants after joining.

    I hope this information helps.

    Best regards,
    Tom Jebo
    Sr Escalation Engineer
    Microsoft Open Specifications Support

    1 person found this answer helpful.