Introduction
Microsoft has added a new PDF generation capability to Power Apps, making it easier than ever to create PDF documents directly from your applications. While the feature is still labelled experimental, it’s available now and is a real improvement on the workarounds makers have relied on until now.
In this guide you’ll learn how to enable and use the PDF function, create PDFs from your screens or containers, and give users a smooth way to view and download what they generate. We’ve also added the settings, limits and mistakes we’ve run into, so you can decide whether it’s ready for your app.
Prefer to watch the video?
Head over to my YouTube channel Chino Does Stuff to watch the video tutorial. You’ll find a variety of videos there, with loads of tricks and tips on the entire Power Platform suite.
Why use the PDF function?
Getting a PDF out of a canvas app has usually meant building a second copy of the layout somewhere else, such as a Word template or an HTML page inside a flow, then converting it. That works, but it’s a lot of moving parts for what is often a one-page summary.
The PDF function takes a different route. You point it at a screen or container that already exists, and it hands back a file.
Your layout is the PDF
What users see in the app is what lands on the page, so there’s no second template to design and keep in step.
One formula, no conversion
You don’t need an HTML template or a document-conversion step just to make the file. A flow is only needed if you want to store it.
Fits the connectors you use
The result is a file you can pass to the Outlook connector or a Power Automate flow, like any other file.
Quick to try
Switch it on, point it at a screen or container, and you can have a first PDF in a few minutes.
How the PDF function works
The PDF function is straightforward. It converts a screen or control into a PDF document and returns the file, which you can keep in a variable or hand to another action. Microsoft’s documentation describes the output as held in memory.
The basic syntax is:
PDF( ScreenOrControl [, { Size, DPI, Margin, Orientation, ExpandContainers } ] )The first argument is what to convert. It can be:
- A screen
- A container, including vertical and horizontal layout containers
- A vertical gallery
The second argument is an optional record of settings, covered below. The function returns a file you can use to:
- Preview the PDF in a PDF viewer control
- Save the PDF to SharePoint or other storage with a flow
- Email the PDF as an attachment
- Open or download the PDF on the user’s device
What the PDF function can and can’t do
Knowing the edges early saves rework. These come from Microsoft’s current documentation for the experimental feature, so check it again if you’re reading this a while after we updated it.
Works well
- Screens, containers and vertical galleries
- Vertical and horizontal layout containers
- Passing the file to an Outlook email or a flow
- Using it in OnSelect, OnVisible, OnHidden or any other behaviour property
- Tall content, when ExpandContainers is set to true
Watch out for
- Only the screen that is currently showing can be exported
- Charts, maps and Power BI tiles aren’t supported
- Nested galleries aren’t supported
- Fillable PDFs aren’t supported
- Non-Latin text and bold or italic styles may not render correctly with some fonts
- The PDF is generated on the user’s device, so very large files or many large images can crash the app, mostly on mobile
Which route should your PDF take?
Making the PDF is only half the job. What happens to it next decides what you need to build around it. Answer two questions before you start.
For most apps we start with the SharePoint route, because the PDF is still there after the app closes and anyone with access can open it again. That’s the route we build below.
Creating a PDF export button
Let’s build a solution that creates a PDF and lets users view and download it. We’ll use a flow to save the PDF to SharePoint and then open it in a new browser tab.
Enabling the experimental PDF function
Because the PDF function is still experimental, you’ll need to switch it on in the app you’re editing:
- Open your Power App in the maker portal.
- Select Settings (the gear icon).
- Select “Upcoming features”.
- Go to the “Experimental” tab.
- Find the PDF function and toggle it to “On”.
- Save your changes.
Once it’s on, the PDF function and the PDF viewer control are available in your app.
Pro tip: Turn it on in each app that will use the function. If the formula isn’t recognised, check the setting first.
Adding the button
Add a button to the screen you want to export and give it an icon that suggests a PDF. The function can only export the screen that’s currently showing, so the button needs to live on that screen.
Pro tip: Disable the button, or show a spinner, while the PDF is being generated so nobody taps it twice.
Connecting to SharePoint for PDF storage
The formula in the next step calls a flow named SaveFileToSharePoint. It’s a standard Power Automate flow that saves a file to a SharePoint document library. If you don’t already have one, you’ll need to create it.
For detailed instructions on building a file upload flow, see our guide to file attachments in Power Apps, which walks through the same kind of flow step by step.
The flow should:
- Accept an ID parameter and a file object with contentBytes and name properties
- Use the “Create file” action to save the file to a SharePoint document library
- Return the URL of the saved file (optional)
Pro tip: If you can, have the flow return the saved file’s URL and launch that, so you never have to build the link by hand.
Writing the OnSelect formula
Add this to the button’s OnSelect property:
OnSelect // 1. Build the file name once, so the saved file and the opened link always match Set( varFileName, "PDF_" & Text(Now(), "yyyymmdd_hhmmss") & "_export.pdf" ); // 2. Turn the current screen into a PDF Set( varPDF, PDF(ViewIssue) // the screen to convert ); // 3. Save the PDF to SharePoint with the SaveFileToSharePoint flow SaveFileToSharePoint.Run( varFileName, { file: { contentBytes: varPDF, name: varFileName } } ); // 4. Open the saved PDF in a new browser tab Launch( "https://yoursharepoint.com/sites/yoursite/Shared%20Documents/" & varFileName );This formula does four things:
- Builds the file name once, so it can be reused
- Creates a PDF from the current screen and stores it in a variable
- Uses the flow to save the PDF to SharePoint
- Opens the saved PDF in a new browser tab with the Launch function
Pro tip: Swap in your own library address. Spaces in the path need to be encoded, such as %20 for a space in “Shared Documents”.
Testing with real content
Run it with your longest real record and open the PDF from a normal user account, not just your own. Check the page breaks, the fonts and that the file opens from the link.
Pro tip: Try it on a phone as well as a laptop. The PDF is made on the device running the app, so results can differ.
Prefer to email the PDF?
If nobody needs a stored copy, skip SharePoint. The PDF can go straight into an email as an attachment through the Office 365 Outlook connector:
// Email the PDF as an attachment, no SharePoint needed
Office365Outlook.SendEmailV2(
"someone@example.com",
"Your inspection report",
"Your report is attached.",
{
Attachments: Table(
{
Name: "Inspection report.pdf",
ContentBytes: varPDF
}
)
}
);Customising your PDFs
The PDF function also accepts an optional record that changes the page. Here are two examples:
// A whole screen, with page settings
PDF(
Screen1,
{
Size: "A4",
DPI: 150,
Margin: "20mm",
Orientation: "Portrait"
}
)
// One container only, landscape, with long content expanded
PDF(
Container1,
{
Size: "A3",
Orientation: "Landscape",
ExpandContainers: true
}
)You can choose to convert only a specific container instead of an entire screen, which gives you more control over what appears in the PDF. These are the settings available:
| Setting | What it does | Default |
|---|---|---|
| Size | The page size, for example “A4”, “A3” or “Letter”. | Letter in the US and Canada, A4 elsewhere |
| DPI | The resolution. It must be greater than 0, and content that doesn’t fit inside the margins may end up at a higher effective DPI. | 96 |
| Margin | The page margin, written with a unit such as in, cm, mm, pt or px. | 0.5 inch (12.7 mm) on every side |
| Orientation | “Portrait” or “Landscape”. | Portrait |
| ExpandContainers | When true, expands screens, containers and scrollable controls so all of their content shows. Nested galleries still aren’t supported. | false |
Setting names and defaults are taken from Microsoft’s documentation at the time of writing. The feature is experimental, so confirm them against the current documentation.
In Australia, set Size to “A4” yourself if you want to be sure, rather than relying on the default. A higher DPI than the default can mean bigger files and more strain on the device, so raise it only when you’ve tested the result.
Using the PDF viewer control
If you want to show a preview of the PDF before saving or downloading it, you can use the PDF viewer control. Add it to your screen and set its Document property to the variable that holds the PDF:
// PDF viewer control, Document property
varPDFTips for better PDF generation
To get the best results from the PDF function, design the page before you write the formula. A screen built for PDF output looks quite different from one built for tapping.
Design PDF-specific layouts
Build the report area for paper, not for tapping.
- Choose a dedicated container, or a dedicated screen you navigate to before calling PDF().
- Take out buttons, menus and input controls from that area.
- Size it for A4 portrait or landscape so it isn’t squashed to fit.
Plan for long content
Real records are longer than the sample you built with.
- Use a single vertical gallery for the rows.
- Set ExpandContainers to true so every row shows.
- Test with the longest record you have, not the tidiest.
Show that something’s happening
PDF generation can take a few seconds.
- Set a variable such as varBusy to true before you call PDF().
- Show a spinner or message while it’s true.
- Set it back to false once the file is saved or opened.
Test on real devices
Output can vary with the device running the app.
- Try a phone or tablet as well as a laptop.
- Use compressed images and keep the layout lean.
- Check fonts, especially non-Latin text, bold and italic.
Use cases for PDF generation
The PDF function opens up many possibilities for Power Apps:
Reports and documentation
Create professional reports that users can download and share, straight from the data they’re looking at.
Certificates and confirmations
Generate certificates of completion or booking confirmations the moment someone finishes a task.
Forms and agreements
Turn a completed form into a PDF record for the file. It’s a static copy, not a fillable form.
Invoices and receipts
Produce clean invoices and receipts that can be downloaded or emailed to the customer.
Work orders and instructions
Give field teams a printable work order or set of instructions with the job details already filled in.
Common mistakes to avoid
These are the slips we see most often when a first PDF export goes from a demo to real use.
Exporting the live working screen
Menus, buttons and inputs end up on the page, and the layout is built for a phone or a mouse, not paper.
InsteadBuild a dedicated report container or screen sized for A4.
Putting charts, maps or Power BI tiles on the page
Microsoft lists these as unsupported, so they’re likely to be missing or wrong in the PDF.
InsteadShow the figures as labels or a gallery of rows instead.
Calling Now() twice for the file name
Each call returns a new time, so the saved file and the link you open can differ by a second or two.
InsteadStore the name in a variable once and reuse it.
Letting a fixed-height list cut rows off
Rows below the visible area are easy to lose, and nobody notices until a customer does.
InsteadUse one vertical gallery and set ExpandContainers to true.
Saving the PDF where users can’t open it
It works for you as the owner, then fails for everyone else with a permissions error.
InsteadSave to a library your audience can already read, and test with a normal user account.
Check before you share the app
- The PDF function is switched on in the app
- The button sits on the screen being exported
- The export area has no charts, maps or Power BI tiles
- The longest realistic record still fits
- Page size and orientation match how it will be printed
- The file name is built once and reused
- The flow saves to a library users can open
- It has been tested on a phone or tablet as well as a laptop
- A loading message shows while the PDF is generated
- Someone knows the feature is experimental and has a fallback
When to get help
Need a hand with Power Apps PDFs?
A first PDF export is quick. A reliable one, with the right layout, a storage flow and the right permissions, takes a little more care. Our Power Platform team can build it with you or for you, and train your people to maintain it.
If you’d rather learn it yourself, Microsoft support and training covers Power Platform too, and business process automation is where we help when the PDF is one step in a longer workflow.
Frequently asked questions
Is the Power Apps PDF function ready for production?
Microsoft labels it experimental and says experimental features aren’t meant for production use. It’s switched off by default. It suits prototypes and internal tools you can test thoroughly, but for anything critical keep a fallback, such as a Power Automate document flow, in your plan.
Can the PDF function create fillable PDFs?
No. Microsoft lists fillable PDFs as not supported. The function produces a static PDF of what’s on the screen, so use it for records, reports and confirmations rather than forms people complete in a PDF reader.
Why is my chart or map missing from the PDF?
Charts, maps and Power BI tiles aren’t supported by the function. Show the same figures as labels or a gallery of rows, and keep any visual-only content out of the area you export.
Why did my app slow down or crash while making a PDF?
The PDF is generated on the device running the app, so large files, or many or large images, can cause problems, particularly on phones. Compress images, keep the layout lean and test on a typical user device before you roll it out.
Can I email the PDF without saving it first?
Yes. The function returns a file you can pass straight to an action connector, such as the Office 365 Outlook connector, or to a Power Automate flow. You only need SharePoint when you want a stored copy.
Conclusion
The new PDF function in Power Apps is a welcome addition that makes it much easier to generate PDF documents directly from your apps. While it’s still experimental, it works well for the right jobs and gives you a cleaner, more integrated solution than the older workarounds.
By combining the PDF function with a SharePoint storage flow and the Launch function, you can give users a smooth way to create, view and download PDFs from your Power Apps.
As the feature moves out of experimental status, we can expect more capabilities and better integration with the rest of the Power Platform. In the meantime, this approach is a practical solution for PDF generation needs, as long as you plan for the limits above.
If you’d like to see more Power Apps tips and techniques, head over to the YouTube channel and leave a comment there. I actively monitor and respond to all YouTube comments!


