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.
The following page includes some account details and renders as a PDF file.

-
Render a Visualforce Page as PDF from Apex
You can use the
PageReference.getContentAsPDF()method in Apex to render a Visualforce page as PDF data. Then use Apex code to convert that PDF data to an email attachment, a document, a Chatter post, and so on. -
Fonts Available When Using Visualforce PDF Rendering
Visualforce PDF rendering supports a limited set of fonts. To ensure that PDF output renders as you expect, use the supported font names. The default font is
serif. -
Visualforce PDF Rendering Considerations and Limitations
Review these considerations and limitations when designing Visualforce pages intended to be rendered to PDF. Always verify the formatting and appearance of the PDF version of your page before you put it into production.
-
Component Behavior When Rendered as PDF
Understanding how Visualforce components behave when converted to PDF is essential to creating pages that render well.
See Also