The secret sauce in our ability to control page breaks within CSS is a little known CSS tag called page-break-after. This tag allows you to control when a page break occurs in a HTML document, or in our case, a PDF document. You can specific whether you want the break to occur before, or after a tag the style is associated with. For this tutorial we are going to want to break after, and so we'll need some CSS that looks like this:
1
page-break-after:always
Now remember when we were deep in Apex code building our collection of arrays of quote line items? It is time we started putting that hard work to the test, and combine it with our page-break-after style. Start by looping over the collection or arrays:
I found the solution.
Use
<div style="page-break-before:always;"> {YOUR CONTENT} </div>
All Answers
I found the solution.
Use
<div style="page-break-before:always;"> {YOUR CONTENT} </div>
From Quinton Wall's excellent article http://wiki.developerforce.com/page/Creating_Professional_PDF_Documents_with_CSS_and_Visualforce:
--- snip ---
The secret sauce in our ability to control page breaks within CSS is a little known CSS tag called
page-break-after
. This tag allows you to control when a page break occurs in a HTML document, or in our case, a PDF document. You can specific whether you want the break to occur before, or after a tag the style is associated with. For this tutorial we are going to want to break after, and so we'll need some CSS that looks like this:1
page-break-after
:
always
Now remember when we were deep in Apex code building our collection of arrays of quote line items? It is time we started putting that hard work to the test, and combine it with our page-break-after style. Start by looping over the collection or arrays:
1
<apex:repeat
value=
"{!pageBrokenQuoteLines}"
var=
"aPageOfQuotes"
id=
"theList"
>
Next we are going to add a div with the following style:
1
<div
style=
"page-break-after:always;"
>
--- snip ---
Thanks Bob