[SalesForce] How to add page breaks to visual force page rendered as pdf so that a dynamically rendered list in apex repeat tag does not strech the table lines

I have created a VF page rendered as pdf for QuoteLineItems in which I have added the list inside <apex:repeat> tags inside a html table row which again is inside another table.The problem however is that when the list includes more elements than the page can hold, the table borders gets streched and the remaining rows are displayed on the next page.
This is my code for rendering the list

                   <table>
                   <tr>
                   <td>
                   <table>
                   <apex:repeat value="{!listQuoteLineItems}" var="product">
                        <tr style="page-break-inside:avoid;">
                            <td>{!product.Product2.Name}</td>
                            <td>{!product.Quantity}</td>
                            <td>{!product.TotalPrice}</td>
                        </tr>
                   </apex:repeat>
                   </table>
                   </td>
                   </tr>
                   </table>

I know i am supposed to use html page-break properties but not sure which and where! I need to display the tables w/o the borders being streched.I hope it is possible to display records partly on both the pages in such case.Please help in any way possible!!

Best Answer

I found an easy solution for the problem, no need to implement any logic for the same just included the following attribute -fs-table-paginate: paginate; in tables style tag and worked like a miracle.

Related Topic