web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Convert File to PDF fr...
Power Automate
Unanswered

Convert File to PDF from flow fails

(0) ShareShare
ReportReport
Posted on by 24

For whatever reason that I cannot understand when I have a flow running to create a file (in docx currently) and pulling from the body of an email which works as designed and is pictured below. It creates a file in a specified folder to trigger the additional flow that I have to convert the file to a pdf. What I need help in understanding and hopefully fixing is why does the convert file work when I directly create a file in the folder in the sharepoint site but it fails at the convert file portion when I have a flow create the file? Also for more information I do get an error code 400 if that helps.

image002.png

 

image001.png

 

Categories:
I have the same question (0)
  • TaylorBecktold Profile Picture
    295 on at

    @ScottRoso  

     

    Could you include: 1) The error you are receiving and 2) A screenshot of the action with its input shown?


    Thanks, 

     

    Did my reply help? Please give it a thumbs up.
    Did my reply answer your question? Please mark it as a solution!
    If you liked my response, please consider giving it a thumbs up.

  • ScottRoso Profile Picture
    24 on at

    @Taylor_Becktold 

    I hope I covered everything that you wanted below. Also, thank you for responding. I appreciate you taking some time to help me with this issue.

     

    image003.png

    "status": 400,

      "message": "Error from Office Service. Url=https://wordcs.officeapps.live.com/document/export/pdf HttpCode=BadRequest cert=subject:;thumbprint: ResponseHeaders=X-ErrorCode: WordCantOpenDocument\r\nX-ClientCorrelationId: fa023c43-e4f8-480e-9a49-ebd97718e503\r\nX-ServiceCorrelationId: fa023c43-e4f8-480e-9a49-ebd97718e503\r\nX-ErrorCategory: BadRequest\r\nX-IsRetriable: False\r\nX-ConversionTimeInMs: 140.6279\r\nX-FileDownloadTimeInMs: 250.0076\r\nCache-Control: private\r\nDate: Thu, 16 Dec 2021 19:31:51 GMT\r\nServer: Microsoft-IIS/10.0\r\nX-AspNet-Version: 4.0.30319\r\nX-Powered-By: ASP.NET\r\n",

      "source": "api.connectorp.svc.ms"

     

    Error from Office Service. Url=https://wordcs.officeapps.live.com/document/export/pdf HttpCode=BadRequest cert=subject:;thumbprint: ResponseHeaders=X-ErrorCode: WordCantOpenDocument

    X-ClientCorrelationId: fa023c43-e4f8-480e-9a49-ebd97718e503

    X-ServiceCorrelationId: fa023c43-e4f8-480e-9a49-ebd97718e503

    X-ErrorCategory: BadRequest

    X-IsRetriable: False

    X-ConversionTimeInMs: 140.6279

    X-FileDownloadTimeInMs: 250.0076

    Cache-Control: private

    Date: Thu, 16 Dec 2021 19:31:51 GMT

    Server: Microsoft-IIS/10.0

    X-AspNet-Version: 4.0.30319

    X-Powered-By: ASP.NET

  • TaylorBecktold Profile Picture
    295 on at

    @ScottRoso  -

     

    Thanks for including that! One other thing I'd like to confirm: Are you able to open the created file in OneDrive? If not, I'll need you to show me how you have configured your 'Create file' action.

     

    I've noticed that this action can require you to convert a base64 string to binary by using the base64ToBinary() expression like so (Microsoft reference documentation😞 

    Taylor_Becktold_0-1639686691210.png

     

    Did my reply help? Please give it a thumbs up.
    Did my reply answer your question? Please mark it as a solution!
    If you liked my response, please consider giving it a thumbs up.

     

  • ScottRoso Profile Picture
    24 on at

    @Taylor_Becktold 

    I am not able to open it in OneDrive and I cannot open the file when it was created in Sharepoint either.

     

    image002(1).pngimage001(1).png

  • TaylorBecktold Profile Picture
    295 on at

    @ScottRoso  -

     

    Try wrapping your 'File Content' parameter value for SharePoint and OneDrive in the base64toBinary() expression that I mentioned earlier. What I believe is happening is that you are creating files with what is considered to be the wrong format and that is creating files that can't be opened. 

     

    Did my reply help? Please give it a thumbs up.
    Did my reply answer your question? Please mark it as a solution!
    If you liked my response, please consider giving it a thumbs up.

  • ScottRoso Profile Picture
    24 on at

    It did not seem to work as this is the error that I receive: Unable to process template language expressions in action 'Create_file' inputs at line '1' and column '3397': 'The template language function 'base64ToBinary' expects its parameter to be a string. The provided value is of type 'Object'. Please see https://aka.ms/logicexpressions#base64ToBinary for usage details.'.

  • TaylorBecktold Profile Picture
    295 on at

    @ScottRoso  

     

    I'm not familiar with the source connector you are using, so this can't be an exact science. Power Automate can sometimes require a significant amount of tinkering or trial and error, especially when utilizing documents/attachments and converting those documents to another format.

    My recommendation is to focus on creating a .docx file in OneDrive that can be opened and then focusing on the convert to PDF, as that is the issue that is preventing you from creating a PDF.

     

    Did my reply help? Please give it a thumbs up.
    Did my reply answer your question? Please mark it as a solution!
    If you liked my response, please consider giving it a thumbs up.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard