Power Automate HTTP request convert Word to PDF

Hi everyone,

I would like to convert a Word (.docx) file with a HTTP Post request in Power Automate in order to convert the file to PDF. I’m able to get is working through Postman, but I don’t know how to do it in Power Automate. I want to avoid the Plumsail connector because if I do so the user has to insert the API-key when connecting to the flow. Can you help me please?

Current setup:

Many thanks in advance!

Hello @kelseyvdheijden,

These settings look correct. Do you have any errors when running the request?

You can additionally test the settings here.

Best regards,
Petr
Plumsail team

1 Like

Thank you for your reply. Here's the error message:

{
"request": {
"url": "/api/v2/convert/docx-to-pdf",
"traceId": "40070fd9-0001-9100-b63f-84710c7967bb"
},
"error": {
"code": "System.ArgumentException",
"message": "The document content empty. Please fill the data in and try again",
"date": "2024-11-06T11:19:35.7117024Z"
}
}

Hello @kelseyvdheijden,

It is necessary to form a multipart content in the body

for example

{
 "$multipart": [
   {
     "headers": {
       "Content-Disposition": "form-data; name=\"File\"; filename=\"application\""
     },
     "body":
   },
   {
     "headers": {
       "Content-Disposition": "form-data; name=\"Data\""
     },
     "body": 
   }
 ],
 "$content-type": "multipart/form-data"
}

Also, use Compose to convert base64 to bytes

Best regards,
Petr
Plumsail team

Thanks, Petr! It works perfectly!

1 Like