An API that connects multiple Microsoft services, enabling data access and automation across platforms
Hello @Kapil Virdi
Basic Conversion Endpoint:
- You can use the following endpoint to convert a Word document to PDF:
Use Postman or Graph Explorer as per your convenience.
GET /drive/items/{item-id}/content?format=pdf - Replace
{item-id}with the ID of the Word document you want to convert
- Detailed Steps:
- Step 1: Upload the Word document to OneDrive or SharePoint.
- Step 2: Use the Graph API to convert the document to PDF. See doc : Convert to other formats - Microsoft Graph v1.0 | Microsoft Learn
- Step 3: Download the converted PDF file from the response stream
- Handling Large Files:
- If you encounter issues with large files, such as a 50MB file failing to convert, it might be due to limitations in the Graph API. You may need to handle such cases separately or consider breaking down the document into smaller parts Relevant doc : Graph API : Convert word document to PDF and download PDF not working for large files - Microsoft Q&A
- Step 2: Use the Graph API to convert the document to PDF. See doc : Convert to other formats - Microsoft Graph v1.0 | Microsoft Learn
- Step 1: Upload the Word document to OneDrive or SharePoint.
Additionally,
- Ensure that the Word document is not encrypted or IRM-protected, as this might cause the conversion to fail Supporting : Convert a encrypted Word docx file to PDF using API? - Microsoft Q&A
- Check the API documentation for any updates or changes to the endpoint and parameters.
GET /drive/items/{item-id}/content?format=pdf
If the above do not help, please feel free to reach out to Microsoft Support with the error logs which has the client request id, request id and timestamp of the failed Graph Request.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.
- Basic Conversion Endpoint:
- You can use the following endpoint to convert a Word document to PDF:
GET /drive/items/{item-id}/content?format=pdf- Replace
{item-id}with the ID of the Word document you want to convert
- Detailed Steps:
- Step 1: Upload the Word document to OneDrive or SharePoint.
- Step 2: Use the Graph API to convert the document to PDF. See doc : Convert to other formats - Microsoft Graph v1.0 | Microsoft Learn
- Step 3: Download the converted PDF file from the response stream
- Handling Large Files:
- If you encounter issues with large files, such as a 50MB file failing to convert, it might be due to limitations in the Graph API. You may need to handle such cases separately or consider breaking down the document into smaller parts
Relevant doc : Graph API : Convert word document to PDF and download PDF not working for large files - Microsoft Q&A
- If you encounter issues with large files, such as a 50MB file failing to convert, it might be due to limitations in the Graph API. You may need to handle such cases separately or consider breaking down the document into smaller parts
- Step 2: Use the Graph API to convert the document to PDF. See doc : Convert to other formats - Microsoft Graph v1.0 | Microsoft Learn
- Step 1: Upload the Word document to OneDrive or SharePoint.
- Replace
- You can use the following endpoint to convert a Word document to PDF:
Additionally,
- Ensure that the Word document is not encrypted or IRM-protected, as this might cause the conversion to fail
Supporting : Convert a encrypted Word docx file to PDF using API? - Microsoft Q&A - Check the API documentation for any updates or changes to the endpoint and parameters.
GET /drive/items/{item-id}/content?format=pdf
If the above do not help, please feel free to reach out to Microsoft Support with the error logs which has the client request id, request id and timestamp of the failed Graph Request.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.