How Do I Print a Power App? Print to PDF Power Automate from Power Apps Trigger
Hello, fellow Power Platform enthusiasts! wanted to share this fabulous discovery. Since Power Apps doesn’t (yet) have a Print feature, there’s a workaround, with the help of Power Automate. First step is to insert an HTML Text input on your Power App and put it in your HTML code. It’ll be something like this, where the values in yellow are replaced with your needed fields:
”
”
Then you add a “Print” button to your Power App and you connect it to a Power Automate. The Power Automate will need to include variables: the HTML text, the file name, the intended recipients of the PDF, etc. It will look like this:
Above, in purple, the variables varHTML, varSendTo, varInitiator, and varFileName are created via the “Initialize Variable” action. All are then connected to the Power Apps using the “Ask PowerApps” feature. These will need to be sent to the Power Automate from your button’s Run string in the Power App. Power App will be so kind as to prompt you for each of these variables, in the order they’re needed. Don’t mind the bold text – that’s simply a result of where my cursor was when I grabbed the screenshot.
The last of the variables, varFullFileName, however, is a concatenated field to add a .html extension to varFileName:
Next are the file creation steps. One Drive is used as a temporary container and will be the path to your eventual SharePoint folder destination for the PDF file.
First you create the file, then you convert the file to a PDF, then you create that PDF file in the SharePoint library. I’ve left all these actions with their original names so you can find them easily when you add your next steps.
Finally, you get to send your magically created file via email. For the Attachments content, it’s import to use the previous created File Content element from Dynamic Content, or the PDF will attach, but won’t encode properly.
Best of luck! Feel free to reach out to us for more information at info@ppmworks.com on the latest Power App and Power Automate solutions!