Graph API - convert from docx to pdf is not working

박 준혁 1 Reputation point
2022-04-19T08:51:38.007+00:00

Hi there,

I am using graph api on my server to convert from msoffice file to pdf file.

Converting a typical docx file to a pdf file works fine.

But even though it's less than 1MB in size, docx files with math symbols don't work

The using api is as follow:

https://graph.microsoft.com/v1.0/users({my ID})/drive/items/{fileId}/content?format=pdf

The error response is as follow:

"error": {
"code": "generalException",
"message": "Error from Office Service. Url=https://wordcs.officeapps.live.com/document/export/pdf HttpCode=InternalServerError cert=subject:;thumbprint: ResponseHeaders=X-ErrorCode: WordConversionTimedOut\r\nX-ClientCorrelationId: b60e4e7c-94b5-4203-8371-920d8f2d53c5\r\nX-ServiceCorrelationId: b60e4e7c-94b5-4203-8371-920d8f2d53c5\r\nX-ErrorCategory: Fatal\r\nX-IsRetriable: False\r\nX-ConversionTimeInMs: 28046.3516\r\nX-FileDownloadTimeInMs: 281.2552\r\nCache-Control: private\r\nDate: Tue, 19 Apr 2022 07:23:25 GMT\r\nServer: Microsoft-IIS/10.0\r\nX-AspNet-Version: 4.0.30319\r\nX-Powered-By: ASP.NET\r\n",
"innererror": {
"code": "OfficeConversion_Fatal"
}
}

Microsoft Security Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Srinivasa Rao Darna 6,761 Reputation points Microsoft External Staff
    2022-04-19T10:21:50.72+00:00

    Hi @박 준혁 ,

    Based on my test with driveitem-get-content-format, it works fine see my test result.

    GET /drive/items/{item-id}/content?format={format}  
    

    Also, the observations on the logs indicate, the error status code [302] generalException and the Graph API returned the response from the word online workload must have timed-out to convert the file.

    • Try with increasing the request time for the request

    194217-817357-download-pdf.jpg

    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.