An effort to bring a revolution in Salesforce.

Sunday, 23 August 2015

How to Set Dynamically Heder|footer in Visualforce page rander as Pdf

 Rander As Pdf Header / Footer  Visualforce  || Saleforce


<apex:page renderAs="pdf" applyBodyTag="false" standardController="Account">
<head>
    <style type="text/css" media="print">
        @page {
            @top-center {
                content: element(header);
            }
            @bottom-left {
            content: element(footer);
            }
           }
           div.header {
           padding: 10px;
           position: running(header);
           }
           div.footer {
           display: block;
           padding: 5px;
           position: running(footer);
           }
           .pagenumber:before {
           content: counter(page);
           }
           .pagecount:before {
           content: counter(pages);
           }
    </style>
</head>
           <div class="header">
              <div>Account name is: {!Account.name} }</div>
           </div>
           <div class="footer">
                <div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>
          </div>
          <div class="content">
               <p>Put all the Page content in this Div Tag  </p>
          </div>
</apex:page>

No comments:

Post a Comment

Get Gmail, Docs, Drive, and Calendar for business