In this article, we will see how we can export data from
canvas app into PDF format with the help of Power Automate.
We are going to keep the example very simple. You can extend
for your requirements.
Power Automate Flow to Create PDF file
- First, we’ll create a Power Automate Instant flow.
- Give proper name to the flow. The trigger type
will be PowerApps.
- We are going to take the input from PowerApps
(Canvas App), Select an input type (String/Text).
- Next Step: Add Create file action
as shown in the screenshot.
- Specify Folder Path (Path where file will
be created), File Name (Name of the file) and File
Content (Content of the file which is passed from the earlier action).
- Next Step: Add Convert File
action. For File, specify Id from the previous action as show in the
screenshot and for Target Type, select PDF.
- Next Step: Again, add action, Create
File and specify three parameters. Here, File Name and File
Content are from Convert File (previous action).
- Next
Step: add action Create Share Link. File should be Id
from previous step. Also specify Link type and Link scope
- Next Step: Add action Respond to a PowerApp or
flow. Specify Variable FileLink and value as Web URL (from previous step).
Canvas App to trigger file creation
- Create a Canvas app and add the power automate
flow (ExportToPDF) that we just created.
- Put a button on the page. This is to trigger the
file creation.
- Put an HTML textbox that you will supply to the
power automate flow.
- Click on the button and in the OnSelect
Property, put this formula. Here, ExportToPDF is the flow name and HtmlText1
is the HTML object of actual data that we want to publish inn PDF file.
Set(PDFLink,
ExportToPDF.Run(HtmlText1.HtmlText).filelink
);
Launch(PDFLink)
·
When you run the canvas app and click on the
button, the flow will run and you will be able to see the PDF file. Browser may
ask you to enable the Pop-up blocker.