function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC coderSFDC coder 

how to maintain table headers on subsequent pages when rendered as pdf??

Hi all,

I have an visualforce email template whose attachment is rendered as pdf.I display an apex repeat tag that iterates over my line items as below.
 
<table>
            <tr>
               <th><center>Product Number</center></th>               
               <th><center>Description</center></th>
               <th><center>Quantity</center></th>
               <th><center>Sales Unit</center></th>
            </tr>
            
            <apex:repeat value="{!relatedTo.Order_Line_Items__r}" var="oli">
                <tr>
                <td><center>{!oli.Product__r.Product_Id__c}</center></td>
                <td><center>{!oli.Product__r.Product_Description__c}</center></td>
                <td><center>{!oli.Quantity__c}</center></td>              
                <td><center>&nbsp;&nbsp;&nbsp;&nbsp;{!oli.Sales_Unit__c}</center></td>
                </tr>
            </apex:repeat>    
         </table>

However when there are multiple line items,the table headers are not displayed on subsequent pages.Can anyone please help?
i also reffered to the link https://developer.salesforce.com/page/Creating_Professional_PDF_Documents_with_CSS_and_Visualforce
however was not able to get it correctly
Best Answer chosen by SFDC coder
SFDC coderSFDC coder
i solved this by referring to a comment on this post..

http://salesforce.stackexchange.com/questions/56935/records-truncated-end-of-page-in-pdf

All Answers

SFDC coderSFDC coder
thanks haarsha..but unfortunately that too doesnt work
SFDC coderSFDC coder
i solved this by referring to a comment on this post..

http://salesforce.stackexchange.com/questions/56935/records-truncated-end-of-page-in-pdf
This was selected as the best answer
Layton EversonLayton Everson
A couple things:
1. Make sure your <apex:page tag looks something like this:
<apex:page 
    standardController="YourObject__c" 
    showHeader="false" 
    sidebar="false" 
    standardStylesheets="false" 
    applyBodyTag="false" 
    applyHtmlTag="false"
    renderAs="pdf">

2. Make sure you have have markup for a full html page:
<html>
    <head>
        <style type="text/css" media="print"></style>
    </head>
    <body></body>
</html>

3. In your CSS add this stuff:
thead{display: table-header-group;}
tfoot{display: table-footer-group;}
table {-fs-table-paginate: paginate;}

 
pavani kanchipavani kanchi
Thanks Layton. Its working.