question

07768592 avatar image
0 Votes"
07768592 asked saldana-msft edited

Graph API - convert from docx to pdf is not working

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-graph-filesmicrosoft-graph-notes
· 11
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello, @07768592, do you mean converting a docx file with math symbols to pdf will give the error? But I tested locally it works fine.

0 Votes 0 ·

Hello @07768592, would you mind providing some contents that contain math symbols in you docx file? SinceI tested it locally with a docx file that contains math symbols and it worked fine, I want to figure out if there are some symbols that are not recognized in Graph.

1 Vote 1 ·
07768592 avatar image 07768592 ZehuiYaoMSFT-7151 ·

Hi @ZehuiYaoMSFT-7151

I'm sorry for the late reply.

There is no problem with the file with some math symbols.

An error occurred while testing with a docx file larger than 300KB containing math symbols.

If you give me an email, I will give you a docx file with math symbols.

0 Votes 0 ·
Show more comments

1 Answer

SrinivasaRaoDarna-MSFT avatar image
0 Votes"
SrinivasaRaoDarna-MSFT answered 07768592 commented

Hi @07768592,

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".


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SrinivasaRaoDarnaMSFT-7657

Thanks to your answer.

But, I said in a question as you can see, common files work well.

Only docx files containing a lot of mathematical symbols have errors

0 Votes 0 ·