Visualforce : Render Page PDF

There are requirements when you need to display, page as PDF, Visualforce supports that as follows,

<apex:page renderas="pdf"  controller="MyController1">
......
</apex:page>

In addition to that you can you can render page dynamically, as following

Page:

<apex:page renderas="{!renderTypeVal}" controller="MyController1">
......
</apex:page>


Controller Class:
 
public class MyController 
 public String getRenderTypeVal()
 {
    // Add your condition for return Value
 
    //When rendering is required as NON PDF 
    //return null;
    
    //When rendering is required as PDF
    //reurntun 'pdf';
 
    return null; 
 }   
} 

Comments

Popular Posts