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 ??


2 Answers 2


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
    Commented Jul 10, 2015 at 22:05

Please use this code its help you

thead, tfoot {
    display: table-row-group

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .