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
Solved! Go to Solution.
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.
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.
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
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.
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.
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.
User | Count |
---|---|
253 | |
106 | |
94 | |
50 | |
39 |