I was able to display tabular report in vf pdf format.this report contains large no of pages. using for displaying table body, but table header is coming in first page. i need to display header in each break up page. Tried with page page-break-before:always css, but not working. Is there any way to identify page breakup and append the header at the starting of page break in pdf?

3 Answers 3


A colleague of mine showed me this solution which I know works.

    <table width="100%" class="mainTable" style="-fs-table-paginate: paginate;">

        <thead style="display: table-header-group;">
                <th width="80px">TRANS DATE</th>
                <th width="120px">TRANS NO</th>
                <th width="120px">DOC REF</th>
                <th width="85px">TRANS TYPE</th>
                <th>PRODUCT/SERVICE DESCRIPTION</th>
                <th width="45px">CURR</th>
                <th width="120px">ORIGINAL AMOUNT</th>
                <th width="90px">AMOUNT DUE</th>
                <th width="70px">DUE DATE</th>

        <tbody style="display: table-row-group;">
            <!-- some rows -->

Does adding these style help?

    table { page-break-inside:auto }
    tr    { page-break-inside:avoid; page-break-after:auto }
    thead { display:table-header-group }

Where are you putting the page-break-before:always tag? You could try moving it to see if that helps. Also, are you using div id="header" for the header on each page or something else?


You must log in to answer this question.

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