Activity Forums Salesforce® Discussions Is it possible to download a vf page by clicking custom button in salesforce?

  • Is it possible to download a vf page by clicking custom button in salesforce?

    Posted by Deepak on September 18, 2019 at 2:06 pm

    Is it possible to download a vf page by clicking custom button in salesforce?

    Saddam replied 5 years, 1 month ago 3 Members · 2 Replies
  • 2 Replies
  • Piyush

    Member
    September 19, 2019 at 6:33 am

    Hi Deepak,

    <apex:page id="MainPage"
               showHeader="false" 
               cache="true"
               contentType="application/x-pdf#Here-is-your-filename.pdf">
    
        <!-- Here comes another page with a content to be converted to PDF -->
        <apex:include pageName="PageThatGeneratesPdf"/>
    </apex:page>
    <apex:page showHeader="false"
               renderAs="PDF"
               cache="true">
    
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    
    <style type="text/css">
    @page{
        size:A4 portrait;
    
        @bottom-right {
            content: "Page " counter(page) " - " counter(pages);
            font-family: 'Arial', 'Helvetica', sans-serif;
            font-size:10px;
        }
    }
    </stype>
    </head>
    
    Here is your main content ...
    
    </apex:page>

     

  • Saddam

    Member
    September 19, 2019 at 6:54 am

    Hi,

    You can just append ‘ renderAs=”pdf” ‘ to you <apex:page> tag.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos