Blank Pages

Contact Us or call 1-877-932-8228
Blank Pages

Blank Pages

The output document created in the last example contains three stories. The way the FO page is currently written, the stories run one after the other with no break. We may want to force a break between the stories. Furthermore, we might want to make sure that each story starts on an odd page.

break-before and break-after

Breaks can be forced with the break-before and break-after attributes, which can appear in any block-level element. Possible values are shown below.

  • auto - does nothing.
  • column - starts a new column.
  • page - starts a new page.
  • odd-page - starts a new odd page, possibly resulting in a blank even page.
  • even-page - starts a new even page, possibly resulting in a blank odd page.

In our case, we want to add break-before attributes to the elements containing the story titles.

The revised code is shown below. Open PageLayout/Demos/OddEvenBreak.pdf to see the output.

Code Sample:

PageLayout/Demos/OddEvenBreak.fo
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<fo:layout-master-set>
---- C O D E   O M I T T E D ----
</fo:layout-master-set>
	
	<fo:page-sequence master-reference="Stories">
---- C O D E   O M I T T E D ----
<fo:flow flow-name="xsl-region-body">
			<fo:block font-weight="bold" font-size="larger" break-before="odd-page">
				POOH GOES VISITING - A.A. Milne
			</fo:block>
---- C O D E   O M I T T E D ----
<fo:block font-weight="bold" font-size="larger" break-before="odd-page">
				A MAD TEA-PARTY - Lewis Carroll
			</fo:block>
---- C O D E   O M I T T E D ----
<fo:block font-weight="bold" font-size="larger" break-before="odd-page">
				THE NAUGHTY BOY - Hans Christian Andersen
			</fo:block>
---- C O D E   O M I T T E D ----
</fo:flow>
		
	</fo:page-sequence>
</fo:root>
Next