Friday 8 January 2016

DETAIL PAGE BUTTON TO SHOW PDF FILE IN SALESFORCE

       
                    Salesforce is as easy as telling 1, 2, 3. Salesforce visualforce is allow us to create a PDF in simple keyword called renderAs
                    
HOW TO SHOW CUSTOM BUTTON THAT DISPLAYS PDF

                    Ok, lets start with creating your visualforce page that renderAs PDF and Add custom button to detail page of the object.

Am using INVOICE object  and the Api Name is Invoice__c.

1. Create Visualforce and name as InvoicePDF.vfp


     <apex:page standardController="Invoice__c"  showHeader="false" sidebar="false"                                 renderAs="PDF">

              //do what you want
              ...........
                         {!Invoice__c.Name}
              .............
             //do what you want

</apex:page>


renderAs="PDF" - This will render the visualforce page as PDF.

2. Add the Custom Button(Visualforce button named InvoicePDF.vfp) to Detail Page.(Optional)

     Goto,
  1. Invoice Object 
  2. Scroll down to Buttons, Links and Actions.
  3. Click new.
  4. Name the Button.
  5. Click on Detail Page Button.
  6. Select Visualforce Page from Dropdown. 
  7. Select InvoicePDF from the list.
  8. Click on Save and Add to PageLayout.


Recommanded : DOWNLOAD PDF'S AS ZIP FILE FROM LIST VIEW OF THE OBJECT


That's it you have done it. Hope it helps you. Thanks.

See you back. Happy Smile!!.

No comments:

Post a Comment