Introduction to the PDF Function in Power apps

Loading

To Enable The PDF function in Power Apps all you have to do is look for the PDF function feature in the Experimental Tab in settings and enable it

First connect the SharePoint list (which we are going to convert to a PDF) to the power apps.

Display the list data in the gallery control as shown below

Add the PDF Document icon on the top of gallery and add the formula to the icon in the onselect proerty

formula :- set(ResultPDFBlob,PDF(screen1))

Add PDF viewer on one side of screen to display the PDF data and add the ResultPDFBlob variable to the PDF viewer in the Document property

Formula :-ResultPDFBlob

After adding functions to the PDF document and viewer icons run the app the result will be showm 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.

To display the data in the gallery on pdf formate change the screen with gallery1 in the above formula as below

Formula :- set(ResultPDFBlob,PDF(Gallery1))

Run the app the result as shown below

The PDF function 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.

The Result will be shown below

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.

When we use ExpandContainer the full items in the gallery will be shown as below

Leave a Reply

Your email address will not be published. Required fields are marked *