Skip to main content

Notifications

Email PDF of screen without (and with) a Flow

A short blog from a post I answered that may be helpful. The need to send a screenshot (it could be a form, invoice or anything else) as an email attachment straight from Power Apps is highly useful.
The process actually is very simple using the PDF() function. Firstly, a temporary variable needs to be created with the file content and that used to form the email attachment. This one is to the user, but could be to any address.

With(
 {_PDF: PDF(ScreenName)},
 Office365Outlook.SendEmailV2(
 User().Email,
 "Subject here",
	 "Body here",
 {
 Attachments: 
 {
 Name: "PDFFileName.pdf",
 ContentBytes: _PDF
 }
 }
 )
)

Note also you can send the same content to a Flow, but need to convert it to Base64

With(
 {
 _PDF: PDF(ScreenName),
 _JSON: 
 With(
 {
 _JSONI: 
 JSON(
 _PDF,
 JSONFormat.IncludeBinaryData
 )
 },
 Mid(
 _JSONI,
 Find(
 ",",
 _JSONI
 ) + 1,
 Len(_JSONI) - 
 Find(
 ",",
 _JSONI
 ) - 1
 )
 )
 },
 AttachFileFlow.Run(
 _JSON,
 User().Email,
 "Test Subject",
 "Test Body",
 "TestFile.pdf",
 )
)

then do the normal base64ToBinary in the Flow

 

AttachPDFFlow.png

Comments

*This post is locked for comments

  • SteveBoling Profile Picture SteveBoling 31
    Posted at
    Email PDF of screen without (and with) a Flow

    Hi Durrani,

     

    I set up a scrolling page with a variable height gallery and then captured the page as a PDF.  It seems to work OK as long as the Canvas datacards overlap on the same visible page.  You should be able to make a variable height form that grows down the Data card.

  • WarrenBelz Profile Picture WarrenBelz 145,567
    Posted at
    Email PDF of screen without (and with) a Flow

    Not that I am aware of

  • Durrani Profile Picture Durrani 32
    Posted at
    Email PDF of screen without (and with) a Flow

    Hi Sir @WarrenBelz ,

    Thank you for your post. I would like to know since this can only share the current screen of the form, If we have multiple pages of the form and we want to send all the screenshots in one pdf file , is there any way to make it possible? Thank you in advance sir.

     

    Kind regards,

    Durrani

     

  • MrAutomate Profile Picture MrAutomate 206
    Posted at
    Email PDF of screen without (and with) a Flow

    Warren,

     

    Thanks, as always, for the great tips! 

     

    You, April, Shane, Randy, Matthew, Reza and too many others to mention, truly make this community an invaluable resource to quickly bring low code apps to production.  

     

    -Brian

  • SteveBoling Profile Picture SteveBoling 31
    Posted at
    Email PDF of screen without (and with) a Flow

    Awesome, this is a total game changer :).  Thank you for sharing