You need to sign in to do that
Don't have an account?
Rocks_SFDC
How to do i insert pdf file generated by visualforce page into attachments related list.
Hello Everyone,
i have a button called "Generate PDF" on Account Detail page.
Once we click on the button i want to generate a pdf file and want to insert into an attachments related list.
Any suggestions would be helpful.
Thanks,
Anil
Hi,
You need to have a separate VF page for the PDF generation and one to put the PDF file into attachment related list.
To put the PDF into attachment, use the getContentAsPDF() method of PageReference class.
Assuming the page that generate the PDF file is GeneratePDF, then:
Note that the getContentAsPDF cannot be used in:
So when you write your test class, use the isRunningTest() method for checking.
Hope it helps.
-Hengky-
All Answers
Hi,
You need to have a separate VF page for the PDF generation and one to put the PDF file into attachment related list.
To put the PDF into attachment, use the getContentAsPDF() method of PageReference class.
Assuming the page that generate the PDF file is GeneratePDF, then:
Note that the getContentAsPDF cannot be used in:
So when you write your test class, use the isRunningTest() method for checking.
Hope it helps.
-Hengky-
Thank you khaiwong. I got it.