其他分享
首页 > 其他分享> > Salesforce: 为PDF VF Page设置Header和Footer

Salesforce: 为PDF VF Page设置Header和Footer

作者:互联网

为转换为PDF的VF page或VF component设置header和footer的代码参考:

<apex:page standardStylesheets="false" id="pge" renderAs="pdf" controller="DynaPdfPageCTRL" applyHtmlTag="false" showHeader="false" >
  <head>
    <style>
      @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>

  <!-- HEADER -->
  <div class="header">
    <apex:image value="{!$Resource.Header_Test_ES}" height="100%" width="100%"/>
  </div>

  <!-- FOOTER -->
  <div class="footer">
    <div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>
    <apex:image value="{!$Resource.Footer_Test_ES}" width="100%" height="100%" />
  </div>

  <!-- CONTENT -->
  <div class="content">
    <apex:repeat value="{!testStringList}" var="s">
      <b>{!s}</b>
      <br/>
    </apex:repeat>
  </div>
</apex:page>

标签:Salesforce,VF,footer,Footer,content,header,page,before
来源: https://www.cnblogs.com/clsriz/p/13901395.html