How to generate PDF using Apex?
You can use the PageReference.getContentAsPDF() method in Apex to render a Visualforce page as PDF data. Then use Apex code to convert that PDF data to an email attachment, a document, a Chatter post, and so on.The following example is a simple three element form that selects an account and a report format, and then sends the …