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.

The Visualforce PDF rendering service has these limitations.

  • PDF is the only supported rendering service.
  • The PDF rendering service renders PDF version 1.4 and CSS versions up to 2.1.
  • Rendering a Visualforce page as a PDF file is intended for pages designed and optimized for print. You can create pages dedicated specifically for PDF rendering.
  • Invalid HTML markup can cause PDF rendering to fail. Not all validation errors are fatal; this includes minor HTML issues generated by Visualforce itself. If you encounter errors when rendering a page, or when calling PageReference.getContentAsPDF() or Blob.toPDF(), use an HTML validator to check your page. Fix any errors in the markup you’ve added to your page’s HTML.
  • 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.
  • Don’t use the PageReference.getContent() or PageReference.getContentAsPDF() methods to retrieve the output of a different Visualforce page with the same controller and controller extensions. Doing so can cause unexpected problems that are difficult to debug. Instead, pass the base URL of the destination page.
    1new PageReference(Site.getBaseUrl() + 
    2    '/apex/VisualforcePageName').getContentAsPdf();
  • 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 scenario most commonly happens with 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. Content then “flows” off the side of the page and is cut 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 the Salesforce mobile app.
  • The font used on the page must be available on the Visualforce PDF rendering service. Web fonts aren’t supported. See Fonts Available When Using Visualforce PDF Rendering.
  • If the PDF file fails to show all of 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:
    1<apex:page showHeader="false" applyBodyTag="false" renderAs="pdf">
    2    <head>
    3        <style>
    4            body { font-family: 'Arial Unicode MS'; }
    5        </style> 
    6    </head>
    7    <body>
    8    
    9    これはサンプルページです。<br/>
    10    This is a sample page: API version 28.0
    11    
    12    </body>
    13</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.
  • PDF rendering doesn’t support WebP images or SVG markup.
  • PDF rendering doesn't support multipage TIFF files.
  • 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.