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

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 populated with items that are users from a group, and the other is a collection that is populated with users from first table. Items with users from first gallery are “moved” to a collection and then, displayed to the secondary gallery.

Like in your example, I put a button that convert both galleries in pdf and send them as attachments to mail. This work great, but if one of these gallery are empty, of course, we get an error…. cannot generate a pdf with an empty gallery .

The main problem is: I try every kind of “combination” to eliminate first gallery from conversion to pdf if this is empty, but with no success !


Both galleries have at Visible -> !IsEmpty(GalleryX….. (to be hidden if they do not contain items)

I try to eliminate the first gallery from conversion by using:



If(Gallery1.Visible = true,


and other kind of combinations, but seems that any conditions are ignored in PowerApps and it get the error to generate that pdf with that gallery, NOT ONLY WHEN IS EMPTY !!

Any kind of condition added at the beginning of “Office365Outlook.SendEmailV2(…..” to eliminate that gallery from export to pdf, is ignored !!! I get the error to generate that pdf … with that gallery… because all conditions are ignored…

Can you give me any suggestions please ? How is correct to put a condition to eliminate a gallery in this case ? I have other cases with conditions to eliminate a gallery, all are functional, they run, but not in this case….

What I do wrong ?

As we know the functionality is still experimental and can have issues.

Retesting the functionality in the same conditions he explained I noted that the issue happens whenever we check a condition for the gallery referenced in the formula later in combination with PDF function and the Outlook connector:


In order to make it work in a simpler way:

1) Add a toggle control to your screen, having as default value:


2) Make this control hidden

3) Replace the If condition to check the control default value instead of the gallery items.


PDF export should work normally then😊


Leave a Reply

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