web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Adding multiple PDF's ...
Power Apps
Answered

Adding multiple PDF's into Office365Outlook.SendEmailv2

(0) ShareShare
ReportReport
Posted on by 102

Afternoon,

 

I'm looking at setting 2 screens on my app to be exported as PDF using the new experimental feature within PowerApps, on my screens I have the following to collect the PDF

 

ClearCollect(colpdfview,PDF(
 scrPDFView,
 {
 Orientation: PaperOrientation.Landscape,
 Size: PaperSize.A4,
 DPI: 96,
 ExpandContainers: false,
 Margin:"1mm"
 }
 ));Navigate(scrPDFViewResults)

 

This I assume grabs everything I need for the PDF apart from the name of the file which isn't important what it's called, I then move to the 2nd screen and Collect the same information for that screen into the same collection.

 

Now my issue is adding this info into an email as 2 attachments, I realise that I may be going about this the wrong way but as PDF stuff is still quite new to me and PowerApps I thought I'd ask.

 

I can do a single PDF into an email no problem using the following

 

Office365Outlook.SendEmailV2(
 "myemail@email.com",
 "Your pdf Subject",
 "Your PDF is attached",
 {
 From: User().Email,
 Attachments: Table(
 {
 ContentBytes: PDF(
 scrPDFView,
 {
 Orientation: PaperOrientation.Landscape,
 Size: PaperSize.A4,
 DPI: 96,
 ExpandContainers: false
 }
 ),
 Name: "Export.pdf"
 }
 )
 }
)

 

Any help getting 2 PDF's using a method like above would be great, I'd like to stay away from Power Automate if possible and keep it within the app.

 

Thanks in advance

 

Simon

Categories:
  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Hi @jimbobcook1,

     

    Try building up several records of PDFs for the Attachments field, similar to the following:

    Attachments: Table(
    	{
    		ContentBytes: PDF(
    			scrPDFView1,
    			{
    				Orientation: PaperOrientation.Landscape,
    				Size: PaperSize.A4,
    				DPI: 96,
    				ExpandContainers: false
    			}
    		),
    		Name: "Export 1.pdf"
    	},
    	{
    		ContentBytes: PDF(
    			scrPDFView2,
    			{
    				Orientation: PaperOrientation.Landscape,
    				Size: PaperSize.A4,
    				DPI: 96,
    				ExpandContainers: false
    			}
    		),
    		Name: "Export 2.pdf"
    	}

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • jimbobcook1 Profile Picture
    102 on at

    Unfortunately the PDF function has to be run on the page and not remotely on another so I couldn't use the screen function but maybe I could put them into a global variable instead, having the collection I though would of been a winner but it seems like it needs a change of code that I'm not familiar with.

     

    I shall try and put the first screen in a variable then do it normally for the 2nd.

     

    Cheers

     

    Simon

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Ah, I understand. Good idea about using global variables!


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • Verified answer
    jimbobcook1 Profile Picture
    102 on at

    Your idea but slightly modified and it seems to work so thank you!

     

    On screen 1 (scrPDFView) I put this in to copy the screen (I used an icon already on the screen to set off a timer so I didn't have a random PDF button, also didn't use containers as I was using the whole screen for data), I then navigate to the next screen 

    Set(gloTestvar,
     PDF(
     scrPDFView,
     {
     Orientation: PaperOrientation.Landscape,
     Size: PaperSize.A4,
     DPI: 96,
     ExpandContainers: false,
     Margin:"1mm"
     }
     ))

    Then on screen 2 (scrPDFViewResults) I have another timer that runs off an icon (this makes sure the gallery has refreshed by the time it takes all the info for the PDF), at the end of the timer I use this

    Office365Outlook.SendEmailV2("sendingtoemail",
     "Enter email subject here",
     "Enter email body here,
     {
     From: User().Email,
     Attachments: Table(
     {
     ContentBytes: PDF(
     scrPDFViewResults,
     {
     Orientation: PaperOrientation.Landscape,
     Size: PaperSize.A4,
     DPI: 96,
     ExpandContainers: false,
     Margin:"1mm"
     }
     ),
     Name: "Export1.pdf"
     },
     
     {
     ContentBytes:gloTestvar,
     Name: "Export2.pdf"
     }
     )
     
    })

    This seems to add both PDF's into the email which makes me very happy.

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    My pleasure @jimbobcook1. Thanks for the update, your solution looks good, glad it's working!


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard