Newer Version Available
Render a Visualforce Page as a PDF File
You can generate a downloadable, printable PDF file of a Visualforce page using the PDF
rendering service.
Convert a page to PDF by changing the <apex:page>
tag.
A Visualforce page rendered
as a PDF file displays either in the browser or is downloaded, depending on
the browser’s settings. Specific behavior depends on the browser, version,
and user settings, and is outside the control of Visualforce.
1<apex:page renderAs="pdf">The following page includes some account details and renders as a PDF
file.
1<apex:page standardController="Account" renderAs="pdf">
2
3<apex:stylesheet value="{!URLFOR($Resource.Styles,'pdf.css')}"/>
4
5<h1>Welcome to Universal Samples!</h1>
6
7<p>Thank you, <b><apex:outputText value=" {!Account.Name}"/></b>, for
8 becoming a new account with Universal Samples.</p>
9
10<p>Your account details are:</p>
11
12<table>
13<tr><th>Account Name</th>
14 <td><apex:outputText value="{!Account.Name}"/></td>
15 </tr>
16<tr><th>Account Rep</th>
17 <td><apex:outputText value="{!Account.Owner.Name}"/></td>
18 </tr>
19<tr><th>Customer Since</th>
20 <td><apex:outputText value="{0,date,long}">
21 <apex:param value="{!Account.CreatedDate}"/>
22 </apex:outputText></td>
23 </tr>
24</table>
25
26</apex:page>
A Visualforce Page
Rendered as a PDF File