Power Apps PDF Function: A Step-by-Step Guide
The PDF function lets you create a PDF document from a screen or specific controls in your app. Imagine being able to generate certificates, invoices, or reports on the fly and send them directly via email or integrate them into a Power Automate flow. Sounds awesome, right?
In this post, I'll walk you through how I used the PDF function to send a certificate as an email attachment from Power Apps only. I'll share the steps I took and some handy tips along the way. Let's dive in!
Step 1: Enable the PDF Function
- Open your app in Power Apps Studio.
- Navigate to Settings.
- Go to Updates: Under the Experimental tab, find the PDF function and toggle it on.
The PDF function is off by default, so the first thing you need to do is enable it:
2. Set Up Your Data Source
I wanted to personalize the certificates, so I built a simple table (or you can use a gallery) to act as a database. In my case, I created a collection "colTrainingData" with three fields:
- Trainee
- Trainer
- Reviewer
This way, I could dynamically insert these values into the certificate.
I used the below Power FX formula to generate the collection in the OnStart property of the app (You can use your own data source):
ClearCollect(colTrainingData, {Trainee: "Esam Shaaban" , Trainer: "Andrew", Reviewer: "Mike"}, {Trainee: "John" , Trainer: "Tony", Reviewer: "evins"})
3. Design Your Certificate Layout
Now comes the fun part - designing the certificate!
Add a Container: Insert a container control to hold all the elements of your certificate. Think of it as the canvas for your design.
Set Background Image: I used a certificate template image as the background of the container. This makes the certificate look professional without too much effort. Make sure that the image is part of the main container.
Tip: Make sure your image is high-resolution to ensure the PDF looks crisp. I used Canva to get the certificate template.
4. Add Dynamic Text Controls
Inside the container:
Insert Text Labels: Add text controls for the trainee, trainer, and reviewer names.
Set Text Properties: For each text control, set the Text property to pull data from your table. For example:
tblTraining.Selected.Trainee
This ensures that when you select a record, the certificate updates with the correct names.

5. Create the Send Certificate Button
Let's make this interactive!
Insert a button and label it "Send Certificate".
Set the OnSelect property of the button with the following function:

conCertificate
) with
specific layout settings:- Size: PaperSize.A4 sets the document to A4 size.
- Margin: "60px" defines a 60-pixel margin around the content.
- ExpandContainers: true / ensures that the certificate container control will be fully expanding to display all content.
- DPI: 96 / sets the document’s resolution.
Add image control to the screen. Change the image position to cover the whale screen and set the visible property to varLoading.
Current limitations:
Certain controls aren't currently supported. These include charts, Power BI tile, Map, and some configurations of third-party PCF controls.
Nested Galleries aren't supported.
Non-Latin script types and font weights and styles such as bold and italic may not appear in the generated PDF for some fonts.
Creation of fillable PDFs isn't supported.
Comments
Post a Comment