PowerApps - Render a screen as PDF and send email
Enable PDF function in Settings:
๐น 1. Use the PDF() Function
Use the PDF() function to render a visual element (usually a Container, Gallery, or even an entire Screen) into a PDF.
Put the following code in a button's OnSelect:
Set(
pdfOutput,
PDF(
MyFormContainer
)
);
๐น 2. Display the PDF in PDF Viewer
The PDF() function returns a Blob URL. Add a PDFViewer and set it Document property to the pdfOutput variable.
PDFViewer1.Document = pdfOutput
๐น 3. Send PDF as an email attachment
Add Office 365 Outlook connectorOffice365Outlook.SendEmailV2(
User().Email, // Receiver email
"YourPdfFileName_" & Now(),
"Please see the attachment", // Email content
{
Attachments: {
Name: "YourPdfFileName_" & Now() & ".pdf",
ContentBytes: pdfOutput
}
}
);
Notify("Email Sent!",NotificationType.Success, 3000);
No comments: