enter image description hereI am creating and pdf page which is having a Page block table. I am having about 40 + items to display on it. My table is getting break in between. I want to display it on another page with with same header. Is their any attribute that i can use?


Indeed there is a specific style attribute that creates page breaks at desired locations on the page.

<div style="page-break-before: always" />

Will move everything that appears after this DIV onto the next page.

There are also other similar page-break properties, you can see how they all work here.

Also note that pageblock table is not recommended to be used in a PDF, you better off replacing that with a normal HTML table using apex:repeat's. There is more information on what Visualforce elements are safe to use in a PDF here.

  • 1
    But <div style="page-break-before: always" /> will move all the content to next page which generates an unnecessary space. – Swapnil Kale Apr 30 '15 at 9:59
  • Check out here how to add header/footer on all your pages - help.salesforce.com/apex/… – Boris Bachovski Apr 30 '15 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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