When designing Visualforce pages
intended to be rendered to PDF, take the following considerations into account. Always
verify the formatting and appearance of the PDF version of your page before putting it into
production.
Limitations of the
Visualforce PDF rendering service
include the following.
- PDF is the only supported rendering service.
- The PDF rendering service renders PDF version 1.4.
- Rendering
a Visualforce page as a
PDF file is intended for pages designed and optimized for
print.
- 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 PDF rendering service renders the markup and data on your page, but it might
not render formatting contained within the contents of rich text area fields
added to the page.
- Long lines of text that don’t have break points, such as a space or dash, can’t
be wrapped by the PDF rendering service. This most commonly happens with very
long URLs, registry entries, and so on. When these lines are wider than the
page, they increase the width of the page’s content beyond the edge of the PDF
page. This causes content to “flow” off the side of the page, cutting it
off.
- Don’t use standard components that aren’t easily formatted for print, or form
elements such as inputs or buttons, or any component that requires JavaScript to
be formatted.
- PDF rendering doesn’t support JavaScript-rendered content.
- PDF rendering isn’t supported for pages in Salesforce1.
- The font used on the page must be available on the Visualforce PDF rendering
service. Web fonts aren’t supported.
- If the PDF file fails to display all the page’s text, particularly multibyte
characters such as Japanese or accented international characters, adjust your
CSS to use a font that supports them. For
example:
<apex:page showHeader="false" applyBodyTag="false" renderAs="pdf">
<head>
<style>
body { font-family: 'Arial Unicode MS'; }
</style>
</head>
<body>
これはサンプルページです。<br/>
This is a sample page: API version 28.0
</body>
</apex:page>
“Arial
Unicode MS” is the only font supported for extended character sets that include
multibyte characters.
- If you use inline CSS styles, set the API version to 28.0 or later. Also set
<apex:page applyBodyTag="false">,
and add static, valid <head> and <body> tags to your page, as in the previous
example.
- The maximum response size when creating a PDF file must be less than 15 MB
before being rendered as a PDF file. This limit is the standard limit for
all Visualforce
requests.
- The maximum file size for a generated PDF file is 60 MB.
- The maximum total size of all images included in a generated PDF is 30 MB.
- PDF rendering doesn’t support images encoded in the data:
URI scheme format.
- The following components don’t support double-byte fonts when rendered as PDF.
- <apex:pageBlock>
- <apex:sectionHeader>
These components aren’t recommended for use in pages rendered as PDF.
- If an <apex:dataTable> or <apex:pageBlockTable> has no <apex:column> components that are
rendered, rendering the page as PDF fails. To work around this issue, set the
table component’s rendered attribute to
false if none of its child <apex:column> components are
rendered.