I would like to as you how to repeat table header ( thead) for each page on the top ?? the simple code is like this :


<messaging:attachment renderAs="pdf" filename="{!relatedTo.Name}.pdf">



                <table border="1">
               <th>Head 1</th>
               <th>Head 2</th>
               <td>value 1</td>
               <td>value 2 </td>
               <td>value 3</td>
               <td> value 4</td>




so according this example , I would like to reapeat ( Head 1 and Head 2) at the beginning of each page . I test this code but it doesn't work :

     @page {
         thead {display: table-header-group;}


I tested thead {display: table-header-group;}but it doesn't work

an idea ??



Inside your CSS in tables style tag, you need to add the following attribute:

table {
    -fs-table-paginate: paginate;

puts a header at the start of each new page where a table crosses a page boundary.

The -fs reportedly refers to Flying Saucer, the render engine used by SF to create PDFs and is specific to that render engine (not for use elsewhere).

  • Yes, Flying Saucer is indeed used by SF to create the PDFs. I don't remember where I read this, but I've had to look at the FS manual on more than one occasion to get some obscure CSS trick to work just right. – sfdcfox Jul 10 '15 at 22:05

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.