How to print a control or screen in PDF format in Power Apps canvas app

Hello everyone and welcome to my blog. Today’s blog is on PDF function in canvas apps and how you can print an entire screen or specific content in a canvas app screen in PDF format.

Canvas app has out-of-box PDF function that can be used to export content in PDF format. You can export the whole screen or you can export a specific Container or Gallery in a screen.

For example, below is my canvas app screen. Here I don’t want to print the entire screen but the the Gallery showing only the coffee machines.

To do that I will use the below formula

Set(pdfContent, PDF(MachineGallery))

The content of the Machine Gallery is now in the variable pdfContent.

I have the PDF content but how do I show it. Well there are multiple ways but the easiest way is to show the content through PDF Viewer control.

Once I have the PDF content, I navigate to a different screen which shall show the PDF output. The screen name in my example is ‘PrintPreview’.

In the PrintPreview screen I have inserted the PDF viewer control. Remember the control is experimental and you shall need to enable it from the experimental features.

I then set the Document property of the control to the pdfContent variable.

When I run the app and click on ‘Print to PDF’ button, the content is generated and rendered in the PDF viewer.

You can now use the Print function in canvas app to eventually Print this PDF. Check the following articles on how to do the same.

You can also save the generated PDF content in SharePoint or send it as an attachment using Outlook connector. More on that in my upcoming blogs.

Hope you liked this post. If this post has helped, you can buy me a coffee. Links on right pane.

For similar topics on Microsoft.NET and Power Platform, subscribe to my blog using the Subscribe option on right pane.

You will also like the below posts.

Debajit Dutta
Business Solutions MVP