Issue: Canvas Apps PDF function – ‘PDF Creation Failed’ when using a gallery and checking conditions
Bildquelle: Shutterstock.com
Power Apps
26. Aug 2023 16:00

Issue: Canvas Apps PDF function – ‘PDF Creation Failed’ when using a gallery and checking conditions

von HubSite 365 über Michel Mendes [MVP]

Microsoft MVP | Senior Consultant at Avanade | Microsoft 365 | Power Platform | SharePoint

Citizen DeveloperPower AppsLearning Selection

Recently a reader reported an issue happening while using the PDF export functionality in Canvas Apps: I have an application with 2 galleries. The first one is

The issue under discussion is the 'PDF Creation Failed' error in Canvas Apps when checking conditions on a gallery and using the PDF export function. This problemoccurs when application users have two galleries. The first gallery is populated with items, which upon moving to a collection, are displayed in the secondary gallery. If either gallery is empty, it leads to the 'PDF Creation Failed' error message.

The problem persists in attempts at resolving the situation through various 'combination' strategies, such as eliminating the first gallery from the PDF conversion if it is empty. However, PowerApps seems to ignore the conditions, leading to a failure in generating the PDF. This is not limited to when the gallery is empty. Furthermore, attempting to introduce a condition at the start of the Office365Outlook.SendEmailV2() function to eliminate this gallery also results in the same error.

Upon retesting under similar conditions, it was noted that the issue occurs when checking a condition for the gallery in combination with the PDF function and the Outlook connector. A potential workaround for this situation is suggested. This method recommends adding a toggle control to the screen, having as default value: IsEmpty(yourGallery.AllItems). This control should be hidden. Lastly, the if condition should be replaced to check the control default value rather than the gallery.

 

Detailed Insights

The Canvas App's functionality concerning PDF creation in the presence of an empty gallery in an application is under question. Several attempts at troubleshooting the situation, often involving codes to exclude the empty gallery or using Microsoft Outlook's SendEmailV2 function, have proved ineffective.

However, a viable solution involves implementing a system where a hidden toggle control checks the default value, replacing the process of checking the gallery itself. This alternate strategy has the potential to overcome the persistent 'PDF Creation Failed' error and improve application users' experience.

 

Read the full article Issue: Canvas Apps PDF function – ‘PDF Creation Failed’ when using a gallery and checking conditions

Learn about Issue: Canvas Apps PDF function – ‘PDF Creation Failed’ when using a gallery and checking conditions

 

Microsoft Expert Answer: The issue of "PDF Creation Failed" when using a gallery and checking conditions in Canvas Apps can be fixed by using a toggle control and setting its default value to IsEmpty(yourGallery.AllItems). The toggle control should then be set to hidden. Instead of using an If condition to check the gallery for empty items, the condition should be replaced by checking the control's default value. This should resolve the issue of "PDF Creation Failed" when using a gallery and checking conditions in Canvas Apps.

 

More links on about Issue: Canvas Apps PDF function – ‘PDF Creation Failed’ when using a gallery and checking conditions

error creating a pdf with the new pdf-function
Dec 14, 2022 — I'm trying to print a scrollable canvas form to PDF so ExpandContainers must be true to capture the whole thing, but I keep getting the PDF creation failed ...
Power Apps PDF Function: Create, View & Download PDFs
Apr 23, 2023 — The new Power Apps PDF Function can easily generate a PDF document from any screen or control and only requires a standard license.
Introduction to the PDF function in Power Apps
Oct 7, 2022 — 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.
First Look: The new (experimental) PDF function ...
Dec 19, 2022 — This function allows makers to create a PDF directly from Power Apps Screens, Galleries, or Containers. With this technology, the PDF is ...
PowerApps canvas app coding standards and guidelines
PowerApps canvas app coding standards and guidelines. White paper. Summary: This technical white paper is aimed at Microsoft PowerApps makers in the ...34 pages
PowerApps Document Viewer: View Word, Excel, PDF & ...
Feb 9, 2022 — In this article, we will create PowerApps document viewer app to learn how PowerApps view documents from the SharePoint document library.
PowerApps Search Function + How to use with example
Mar 10, 2022 — In this Power Apps Tutorial, We will discuss what is the PowerApps Search function, it's syntax, how to use the Power Apps search function ...

Keywords

Microsoft Canvas Apps, PowerApps, PDF function, Error, Gallery, Outlook Connector, Toggle Control