1. Understanding the Power Apps PDF Function
The PDF function in Power Apps allows you to generate PDF documents directly from your app without relying on third-party solutions. It converts the contents of a supported control into a PDF file that can be previewed, emailed, or saved to external storage such as SharePoint.
The generated PDF is returned as a binary blob, which can be stored in a variable and reused throughout the app. This makes it easy to create reports, invoices, forms, and other business documents from data already displayed in your application.
2. Supported Controls and How the PDF Function Works
The PDF function works by capturing the content of a supported Power Apps control and converting it into a PDF document.
It supports the following controls:
- Entire screens
- Gallery controls
- Container controls
However, it does not support Data Table controls directly. If you need to export a Data Table, place it inside a Container and generate the PDF from that container instead.
A typical workflow includes:
- Calling the PDF function from a button or icon.
- Saving the generated PDF into a variable.
- Displaying the PDF using the built-in PDF Viewer.
- Reusing the same PDF for emailing or saving to SharePoint.
This approach lets you generate documents from a complete screen, a gallery, or any grouped content inside a container.
3. Customizing PDF Output
The PDF function provides several options to control how the exported document looks and behaves.
You can customize:
- Page Orientation (Portrait or Landscape)
- Paper Size (such as A1 and other supported sizes)
- Page Margins
- Expand Containers to include hidden or scrollable content
One of the most useful options is expandContainers.
When expandContainers is disabled, only the content currently visible on the screen is included in the PDF. If a gallery displays only a few records, only those visible records are exported.
When expandContainers is enabled, Power Apps renders the entire gallery or container, including items outside the visible area. This is especially useful when exporting long reports, image galleries, or large datasets that span multiple pages.
4. Sending and Saving PDF Files
Once a PDF is generated, it can be shared or stored directly from Power Apps.
Using the Office 365 Outlook connector, you can attach the generated PDF to an email by passing the PDF blob as an attachment. Each attachment requires a filename (including the .pdf extension) and the PDF content, allowing users to send reports, invoices, or forms without leaving the app.
You can also save the PDF to a SharePoint document library using Power Automate. Create a flow with the PowerApps (V2) trigger, accept the PDF as a file input, and use the Create file action to upload it to the desired library. This approach is ideal for document management, approval processes, and maintaining digital records.
5. Working with Images, Galleries, and Attachments
The PDF function can capture more than just text. It can also include images, signatures, and attachments displayed inside galleries or containers.
For example, if your app allows users to upload photos or capture signatures, placing both the form and the attachment gallery inside a single container enables the PDF function to export everything together into one document.
When exporting galleries with multiple records or images, enabling expandContainers ensures that all items are included in the PDF instead of only the visible portion. This makes it easy to generate complete inspection reports, maintenance records, event summaries, or any document that combines data with supporting images.
6. Common Limitations and Best Practices
Before implementing the PDF function in production, keep these important points in mind:
- Generate PDFs only from supported controls such as Screens, Galleries, or Containers.
- Wrap unsupported controls like Data Tables inside a container before exporting.
- Always include the .pdf file extension when sending emails or saving files.
- Use expandContainers = true whenever the content extends beyond the visible screen.
- Store the generated PDF in a variable so it can be reused for previewing, emailing, or saving without generating it multiple times.
- Test large reports to ensure all pages and attachments are rendered correctly before sharing them.
Following these practices helps create reliable, professional PDF documents while avoiding common issues during export, email, and SharePoint integration.