Last active
June 27, 2019 15:51
-
-
Save aptkdev/81f2d4d3d56e55accf2881ad0a859dff to your computer and use it in GitHub Desktop.
Document Generation 6
This file contains hidden or 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
public class Example { | |
public static Blob generatePDF(String recordId) { | |
// create a virtual page | |
PageReference page = new PageReference('/apex/MyPage'); | |
// add our record id | |
page.getParameters().put('Id', recordId); | |
// generate and PDF blob | |
// You can save this blob as a file, document, or attachment! | |
return page.getContentAsPDF(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment