You need to sign in to do that
Don't have an account?
Jonathan Wolff 7
Creating Apex with PageReference.getContentAsPDF() to create pdf in flow
Hello, I have a Visualforce template. I want to use an apex class with PageReference.getContentAsPDF() to create a pdf through a flow with the VF template. Could you give me an example of the Apex class to use for my "Visualforce code" that I can add to a flow to create a pdf. (I want to achive, that the fields of the visualforce like (!Account.Name) are filled with screen flow inputs)
Thank you in advance.
Greetings
Jonathan
My Visualforce code:
Thank you in advance.
Greetings
Jonathan
My Visualforce code:
<apex:page standardController="Account" renderAs="pdf" > <h1>Welcome to APP!</h1> <p>Thank you, <b><apex:outputText value=" {!Account.Name}"/></b>, for working with APP.</p> <p>Your account details are:</p> <table> <tr><th>Account Name</th> <td><apex:outputText value="{!Account.Name}"/></td> </tr> <tr><th>Account Rep</th> <td><apex:outputText value="{!Account.Owner.Name}"/></td> </tr> <tr><th>Customer Since</th> <td><apex:outputText value="{0,date,long}"> <apex:param value="{!Account.CreatedDate}"/> </apex:outputText></td> </tr> </table> </apex:page>
Please find the below code as sample:
Use the below links for reference :
https://automationchampion.com/2021/10/05/generating-a-quote-pdf-using-salesforce-flow/
https://github.com/Rakeshistom/Auto-Generates-Quote-PDF/blob/master/generateQuotePdfDocument.cls
https://trailhead.salesforce.com/en/trailblazer-community/feed/0D54S00000A90DSSAZ
Thanks,
Maharajan.C
Thanks,
Maharajan.C