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

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Convert Base64 from a ...
Power Automate
Unanswered

Convert Base64 from a RestAPI JSON into a PDF

(1) ShareShare
ReportReport
Posted on by 18

Hi there

 

I have a small problem which I can not solve.

 

I receive a document in Base64 via a REST API. According to other forum posts and instructions I found, it should be possible to convert the data to binary and then save it as a document on Sharepoint.

The flow goes through without a problem as well. Only the document (PDF) is not correct on Sharepoint and cannot be viewed. The Base64 code does not seem to have been changed to binary.

HTTPS.jpgComposing.jpg

 

The final result is still just a Base64-Code. I tested it to transfer it to a PDF with a simple online-tool. It works and it gives the correct result.

 

Does anyone have an idea what this could be?

 

Categories:
I have the same question (0)
  • Troels Profile Picture
    4 on at
    Re: Convert Base64 from a RestAPI JSON into a PDF

    Hey Gotorus

    I had a similar problem trying to attach a pdf when sending an email. I realized that the output of the Base64ToBinary function is an object in the below format (which seems to be the way Power Automate represents binary data):

     
    {
      "$content-type": "application/octet-stream",
      "$content": <the base64-string>
    }
     
    So since the SharePoint action is expecting a binary-type object for "File Content", I think the issue is that the output of the "Base64ToBinary Label" action is not in the same format as above but rather something like this:
     
    {
      "$content-type": "application/pdf",
      "$content": {
        "$content-type""application/octet-stream",
        "$content": <the base64-string>
      }
    }
     
    Try to use just the base64-string for the "$content" of the "Base64ToBinary Label" action:
    {
      "$content-type": "application/pdf",
      "$content": outputs('Compose_Label_Base64')
    }
  • Verified answer
    Gotorus Profile Picture
    18 on at
    Re: Convert Base64 from a RestAPI JSON into a PDF

    Hey Troels

    Thanks for your answer!

    I tried this, but it was not a different result.

    But I found the problem. It was very simple. I had to remove the "- and []-characters. Then it worked.

  • LSB Profile Picture
    33 on at
    Convert Base64 from a RestAPI JSON into a PDF
    What exactly do you mean? You deleted every - and [] in the base64 stream before you gave it to the compose node?
     
    Can you provide me with a screenshot of your working flow?

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
Tomac Profile Picture

Tomac 532 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 461 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 256

Last 30 days Overall leaderboard