+ Start a Discussion

Different header and footer for each page



I have a visualforce page, I have displayed pdf through visualforce page. If i have 4 pages in in my vf page pdf,


I need to set the one header and footer  for first page. And I need to set the header and footer for middle two pages as same. And for last page i need to set different header and footter. Please help me.


I have achieved for first and remaining 2 pages. But for last page its displaying same header and footer which is in 2nd and 3rd page. Please help me how to set different header and footer for last page. I have used the following code.


           margin : 70pt .0in .9in .0in;
         @top-left {
             content : element(header);
             content : element(footer);
       div.header {
           position : running(header) ;}
       div.footer {
            position : running(footer) ;}

       @page {
           margin : 110pt .0in .9in .0in;
         @top-left {
             content : element(header_remainpages);

             content : element(footer_remainpages); }

             position : running(header_remainpages) ;
       div.footer_remainpages {
             position : running(footer_remainpages) ; }




<div class="header">
     <apex:image value="{!$Resource.otter_image_total}" width="300%" height="200%"/>

<div class="footer">
   <apex:image value="{!$Resource.Footer}" width="300%" height="100%"/>

<div class="header_remainpages">
     <apex:image value="{!$Resource.Header1}" width="300%" height="200%"/>

<div class="footer_remainpages">
    <apex:image value="{!$Resource.Footer1}" width="300%" height="100%"/>


Please help me out. Its very urgent for me. Thanks in advance.