function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mstev45mstev45 

Using a button to display record as PDF

Hi, i am very new to visualforce.

 

What i am trying to create is a custom button on a detail page of a custom record. When the user clicks on the button i want it to view the the record as PDF format. I know how to create the button and then load a visualforce page, and i know there is the renderAs="pdf" function. What i am struggling with is how to show all display the fields from the record in the pdf page.

 

Any help on this would be great.

 

Matt

Best Answer chosen by Admin (Salesforce Developers) 
aalbertaalbert

Here is an example: http://wiki.developerforce.com/index.php/Visualforce_Quote2PDF

 

In short, create a Visualforce page with the renderAs="pdf" and in that page, simply use apex:outputField or apex:outputText components to output the values. 

 

 

All Answers

aalbertaalbert

Here is an example: http://wiki.developerforce.com/index.php/Visualforce_Quote2PDF

 

In short, create a Visualforce page with the renderAs="pdf" and in that page, simply use apex:outputField or apex:outputText components to output the values. 

 

 

This was selected as the best answer
mstev45mstev45

That is exactly the sort of thing i was looking for thanks. I just used the <apex:outputField> tag as you suggested and it worked perfectly. Just one more quick question, it doesnt include the field label when i do this it just outputs the field value, how do i include the field label aswell?

 

Many Thanks,

 

Matt