Power Platform: Print selected data table record to PDF file from PowerApps using Power Automate

If you see someone without a smile today, give ’em yours 🙂
.
Hello Everyone,
Hope you all are doing well.
Today in this article I am going to discuss about how to print selected data table record to PDF file from PowerApps using Power Automate.
We have good number of articles on Power Platform, please have a look.
https://knowledge-junction.in/category/technology-articles/power-platform/
So without getting late, lets get started.
Requirement
Having a dashboard screen with data table control and with all required filter options is a very common use case in PowerApps app. For every process such dashboards are required so that users can view and manage the records. Creating PDFs from the data sources is a standard requirement in many cases. For instance, getting data from SPO list or getting from Power Apps, generating pdf file.
Note : The HTML content cannot be greater than 2 MB for this PDF generation to work. This is the limitation of the Create File action for the ‘One drive for business’ connector.
Solution
There is no direct connector in PowerApps to print the data to a pdf file, so we must trigger a FLOW from PowerApps and generate the PDF file in OneDrive or SharePoint and respond back with URL of the generated file.
Introduction:
The Errors app is used by people at an office to print the selected record in PDF. They open the app to the Error details screen, click on print to download and then open the PDF file.
Setup the SharePoint list
- Create a new SharePoint list called Errors with the following columns:
Title | Single line of text |
Error from | Single line of text |
Error message | Multiple lines of text |
Cause | Multiple lines of text |
Resolution | Multiple lines of text |
Severity | Choice |
Single line of text |
- Include this data in the list.

Insert a table to display information in the app.
- Open Power Apps Studio and create a new app from blank. Place a label at the top of the screen showing the title.

- Add the Errors SharePoint list as a datasource.

- Then insert a data table with and update the Items property to ‘Errors’ to show the list of error details.

In data table columns, made the Print column as hyper link to download the respective record details in PDF.

Creating the print PDF flow.
- Now we are ready to make the flow to print the errors table selected data to a PDF file. Go to the Action tab and select Power Automate. Then click create a new flow.

- Refer to the below screenshot to understand the steps used in FLOW -> Taking filter values as parameters from PowerApps.

- Use the varItemID variable output/result as input to Get Items as shown below -> Use compose action to generate tabular data, add whatever columns we want to print in PDF file.


- Use OneDrive create file action to create a html file, then use convert file action to convert the html file to the PDF file.

- Use OneDrive create file action to create a PDF file, then use create share link by path action to generate the PDF file URL, respond back this URL to PowerApps.

- At last, to print the selected record data to PDF by its hyperlink. Select the Print column and apply the below formula on its OnSelect property as:
Concurrent (Notify("Working on it...", NotificationType.Information), Set(pdfFileURL, PrintPDF.Run(tbl_Errors.Selected.ID).fileurl));Launch(pdfFileURL);

- We have triggered a FLOW on print of a record. If we see the Print column click code, then we have used Launch function to download the PDF file for end user.
- This is how the selected data looks in the PDF file, the user can easily save/print it as PDF file and do the analysis.

.
Hope this article will help us to print the selected data table records to a PDF file from PowerApps using Power Automate.
Also get my article updates on my social media handles.
LinkedIn – https://www.linkedin.com/in/khasim-shaik-8784a1232/
Twitter – https://twitter.com/KhasimShaik2009
Facebook – https://www.facebook.com/profile.php?id=100078255554660
Thank you for your support, will catch up with new article soon.
Keep learning and keep sharing.
Have a great day.
Thanks.
You must log in to post a comment.