To Convert a Base64 string to PDF or any other image file >> there is no direct way to convert in PowerApps.
High level resolution steps
- We convert the Base64 to Binary first
- Create & Stage the file in Azure Blob in our case. (You can use OneDrive to stage the file as well)
- Use DataUri to convert Binary into a uniform resource identifier (URI) version of that string.
Detailed resolution steps
Step 1: Use a manual trigger flow and pass the bas64 string.
Step 2: Add a compose action and use the formula as shown in the below picture:
Step 3: Stage the file in Azure Blob Container that will be created in Azure Portal and provide the blob name with proper extension and for blob content provide the outputs from compose action as shown below:
Step 4: Now we must Initialize one variable and, in the value – provide the blob container URL(available from Azure Portal) and followed by the path that will be coming in from Previous Action as shown below:
Step 5: Add another compose action and convert a string into a uniform resource identifier (URI) version of that string in the specified format below:
Output:
Get the Output or respond back to PowerApps as shown below:
The URL will be exposed out of the Base64 that you provided.
If we try opening the URL in a browser, a PDF file will be displayed to you.
Technical Consultant – Enjoys created low code applications using Power platform, skilled at creating automate flow using Power automate and Power Virtual agents.