Created
July 25, 2016 22:48
-
-
Save keithmancuso/9539cafab1bb3ea45dada8546f31c9c5 to your computer and use it in GitHub Desktop.
Attach PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PageReference pdf = Page.PrintSet; | |
pdf.getParameters().put('id',customerId); | |
pdf.setRedirect(true); | |
// Take the PDF contents | |
Blob b = pdf.getContent(); | |
// Create the email attachment | |
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment(); | |
efa.setFileName('actionPlan.pdf'); | |
efa.setBody(b); | |
email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment