Uploading a file using Ecodian (HTML to PDF) and Power Automate

I’m working on a Power Automate flow that converts data collected from Microsoft Forms into an HTML file, which I then convert into a PDF using Ecodian. Currently, the flow successfully sends the generated PDF via email.

However, I now need to push this PDF file into HubSpot as part of a new requirement. While I was able to successfully push the file as an HTML document into HubSpot, I’m encountering an error (as shown in the screenshot below) when trying to upload the PDF version. I’m seeking guidance on why the PDF fails to load in HubSpot and how to resolve this issue.

Any help or insights would be appreciated!

The file successfully pushes to HubSpot but clicking to view the pdf, I get the below error:

Copy of the current code:

URL: https://api.hubapi.com/files/v3/files

Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

Body:

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name=“file”; filename=“OnboardingForm.pdf”
Content-Type: application/pdf

@{outputs(‘Compose_PDF_Content’)}

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name=“folderId”
176084124214
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name=“options”
Content-Type: application/json
{“access”: “PUBLIC_INDEXABLE”}
------WebKitFormBoundary7MA4YWxkTrZu0gW--

*** This is what is in the

@{outputs(‘Compose_PDF_Content’)} variable***

This is a screenshot of the power automate flow:

Hey, @JToussaint1 :waving_hand: Thank you very much for the interesting, and well organized, question. While I don’t have the answer, I did some digging to see if we can at least run through some troubleshooting steps to help narrow things down.

It sounds like the PDF issue could be related to how the file is generated or uploaded, but it’s hard to say without more info.

Next steps:
•Have you tried downloading the generated PDF and opening it in a browser or PDF viewer to verify it’s correctly constructed?
• Have you looked into using a “Compose” action in Power Automate to review the PDF content before uploading? Looking in a related but different thread, have you tried converting it to Base64?
• If you haven’t already, you might try to send it to yourself to ensure the file is intact before trying the HubSpot upload.
• How big are the PDF files you’re generating?
• Try uploading the PDF directly in-app using the File Manager and see if the issue lies with Power Automate or the file itself. Will the file upload, and render as expected, when done in-app?

Have fun testing! — Jaycee