The Visualforce page component defines a renderAs attribute that supports certain content converters. This is extremely useful when automatically printing forms, receipts, reports, etc. Often, we’re asked to create nicely formatted forms that span multiple pages. If you leave the control of page breaks to the browser unexpected things can happen. This is an easy solution to solve with some basic CSS. You can use the page-break style properties to control where the browser will insert a page break. The Force.com PDF content converter will carry that over to the PDF.
Here’s the basic code to demonstrate how this works. Create a new Visualforce Page called MultiPagePDF. Add the following code to the page:
And, finally… page three
As a quick side note, you can get a bit more advanced with the Page formatting via CSS. The following snippet shows you have to switch the page layout to landscape and add page numbers to your Visualforce page. This was found in the Case History Timeline example.
/* Landscape orientation */
/* Put page numbers in the top right corner of each
page in the pdf document. */
content: "Page " counter(page);