You need to sign in to do that
Don't have an account?
Eric Bissonnette
Generate pdf from Visualforce and assign it to a action button
Trying to get a better output of my account tab than the "Printable View"
I would like to Generate pdf from Visualforce and assign it to a action button. This way by one simple click they will have a client snapshot.
Thanks
Eric
I would like to Generate pdf from Visualforce and assign it to a action button. This way by one simple click they will have a client snapshot.
Thanks
Eric
<apex:page renderAs="pdf">
Create one more visualforce page with same controller code and visualforce page code and the only change is use renderas attribute in the visualforce page code. Then call this visualforce page from the 'Export to PDF' custom button action and pass the necessary parameters to the visualforce page to render the data as PDF page.
Check this visual force developer guide for more details - https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_renderas_pdf.htm
For further reference, You can use the below code,
http://www.interactiveties.com/blog/2015/visualforce-button-pdf.php
If it helps mark this as the best answer.
All Answers
<apex:page renderAs="pdf">
Create one more visualforce page with same controller code and visualforce page code and the only change is use renderas attribute in the visualforce page code. Then call this visualforce page from the 'Export to PDF' custom button action and pass the necessary parameters to the visualforce page to render the data as PDF page.
Check this visual force developer guide for more details - https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_renderas_pdf.htm
For further reference, You can use the below code,
http://www.interactiveties.com/blog/2015/visualforce-button-pdf.php
If it helps mark this as the best answer.
Here are the steps to generate a PDF from a Visualforce page and assign it to an action button:
- Create a Visualforce page and controller that contain the content you want to include in the PDF.
- Add the "renderAs" attribute to the apex:page tag, setting it to "pdf", to ensure that the page is rendered as a PDF:
- Create a button or link that, upon clicking, will render a Visualforce page as a PDF by assigning the Visualforce page to it.
To learn more about generating PDFs in Salesforce, you can refer to the article at https://arrify.com/generate-pdf-in-salesforce/. This article provides a detailed guide with step-by-step demonstrations on PDF generation in Salesforce, covering various methods and limitations.