Have you ever wanted to create a PDF from your Power Apps Screens? Now you can using a the new PDF function in Power Apps
Enabling the PDF Function in Power Apps
Table of Contents
To enable this new experimental feature all you have to do is look for the PDF function feature in the Experimental tab and enable it.

Using the PDF function in Power Apps
Now straight away you will be able to use the PDF function in Power Apps as shown below.

Now the result variable is set to the content of the file. In the screenshot below I’m displaying the content in the PDF Viewer control, but you can of course do a lot more with it. If you generate a PDF, you might as well store the file in SharePoint or send it as an attachment in an email.

The PDF function Options
So what are the options available?

The PDF function isn’t documented yet. So it isn’t easy to figure out what the options are.
The only place where I ‘ve seen these documented is on a community blog page by Hiro

Ok, so we have a few options.
Orientation – You can set this to Landscape or Portrait.
Size – you have many options. If you type “Papersize.” the intellisense in Power Apps will do the rest for you

Margin – With the Margin property you have some control over the margins of your page. You will have to give 4 values. Left, Top, Right and Bottom.
DPI – This setting makes it possible to control the quality ( and the size) of your PDF.
Then the final option is Expand Containers. This last option needs a bit of a further explanation and also a warning.
Imagine if you have a Gallery ( or any other container with a scroll bar) and only some of the content is visible. you can now expand that content to make it possible to see all of the content within your PDF. Just set the ExpandContainers property to true.
But… Like I already mentioned the expand property does come with a warning.
As shown below I managed to expand my gallery, however the content following the container doesn’t move with it. So if you want to generate PODFs form your Power Apps Pages, be careful not to add any additional content underneath the container.

Hi Peter,
Yes very nice but one item I still have not solved.
I added a Portrait Printable screen (only to get the A4 sizing) and a HTML text box with a form including graphics on it – printed very nicely.
I can then attach the PDF to an email (we are looking at invoices) with
Office365Outlook.SendEmailV2(
“MailAddress@Here”,
“Subject here”,
“Body here”,
{
Attachments: {
Name: “FileNameHere”,
ContentBytes: varInvoice
}
}
);
Works great – now I want to attach the PDF to the file. I know I can do it the “old” way by sending the HTML to OneDrive and PDFing it there, but when I send the Variable as the file content to a Flow, I get no errors and the PDF attaches, but the file format is invalid and will not open. I have also tried JSON to Base64 (the output looks like Base64), but the Flow fails on conversion base64ToBinary.
Hi Peter,
Error on my part – works perfectly with JSON if the header and leading/trailing quotes are stripped. So you can both attach to emails and also create files or attachments with it.