A family of Microsoft word processing software products for creating web, email, and print documents.
You can easily generate a PDF from a Word document in the backend using Microsoft Graph API without opening Word manually. If your contract files are stored in OneDrive or SharePoint Online, Graph can do the conversion directly with a simple REST call.
How it works
- Upload or save the generated .docx file to OneDrive or SharePoint.
- Use the Graph API endpoint:
GET /drives/{drive-id}/items/{item-id}/content?format=pdf
- This returns the PDF version of the Word file that you can either stream or download to your system.
Sample Request
GET https://graph.microsoft.com/v1.0/me/drive/root:/Contracts/Contract123.docx:/content?format=pdf
Authorization: Bearer {access_token}
This downloads the same document as a PDF file.
Requirements
- The document must be in OneDrive or SharePoint.
- You need proper Graph API permissions like Files.Read or Files.ReadWrite.All.
- Works best for automated, server-side conversions where you already handle document creation.
Resources
- Convert to other formats - Microsoft Graph v1.0 – Official docs endpoint reference.
- How to convert Office documents to PDF with Microsoft Graph – Step-by-step guide using Graph and Azure Functions.
- Graph API – Community example for SharePoint-hosted files.
If you prefer automation, you can even wrap this Graph call in an Azure Function to trigger automatically after generating the Word document.