Advanced PDF to Render Visualforce Page as PDF File

Advanced PDF to Render Visualforce Page as PDF File

Advanced PDF renders Visualforce pages as PDF files with broader support for modern HTML standards, such as CSS3, JavaScript, and HTML5. This change applies to both Lightning Experience and Salesforce Classic.

To use Advanced PDF, set renderAs=”advanced_pdf” in the <apex:page> tag of a Visualforce page with API version 40.0 or later.


  1. 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.
  2. 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.
  3. The maximum file size for a generated PDF file is 60 MB.
  4. The maximum total size of all images included in a generated PDF is 30 MB.
  5. PDF rendering doesn’t support images encoded in the data: URI scheme format.
  6. The following components don’t support double-byte fonts when rendered as PDF.<apex:pageBlock><apex:sectionHeader>
  7. These components aren’t recommended for use in pages rendered as PDF.
  8. 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.

Sample Code:
<apex:page readOnly=”true”    
        <meta http-equiv=”Content-Type” content=”text/html;charset=UTF-8″ />   
        <style type=”text/css”>              
            @page {   
                size: A4 landscape;   
                border: 2px solid black;   
                padding-left: 8px;   
                padding-right: 8px;     
            th {   
                text-align: center;   
                font-weight: bold;   
            td {   
                text-align: center;   
                font-size: 14px;   
        <h3>Testing Advanced PDF = {!Account.Name}</h3>             
    <table border=”1″ width=”99%”>         
            <th>First Name</th>   
            <th>Last Name</th>                 
        <apex:repeat value=”{!Account.Contacts}” var=”con”>             

Create Quick Action for the Visualforce Page and add it to the page layout to test.



2 thoughts on “Advanced PDF to Render Visualforce Page as PDF File

Leave a Reply