Pagination

Top Previous Topic Next Topic  Print this topic

 

Every page has the following regions:

- fo:region-body which holds the main page content, that is, the content of fo:flow

- fo:region-before, used to display headers

- fo:region-after, used to display footers

- fo:region-start and fo:region-end, used to display side regions (left, respectively right)

 

Of all regions, fo:region-body can have multiple columns.

 

Example of usage:

 

 

<?xml version="1.0" encoding="utf-8" ?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

       <fo:layout-master-set>

               <fo:simple-page-master master-name="all-pages" page-width="5in" page-height="5in">

                       <fo:region-body region-name="Content" margin="0.7in" column-gap="0.25in" padding="6pt" column-count="2"/>

                       <fo:region-before region-name="Header" extent="0.7in" display-align="after" padding="6pt" background-color="red"/>

                       <fo:region-after region-name="Footer" extent="0.7in" display-align="before" padding="6pt" background-color="blue" precedence="true"/>

                       <fo:region-start region-name="LeftMargin" extent="0.7in" padding="6pt" background-color="green" reference-orientation="90" display-align="after"/>

                       <fo:region-end region-name="RightMargin" extent="0.7in" padding="6pt" background-color="yellow" reference-orientation="-90" display-align="after"/>

               </fo:simple-page-master>

               <fo:page-sequence-master master-name="default-sequence">

                       <fo:repeatable-page-master-reference master-reference="all-pages"/>

               </fo:page-sequence-master>

       </fo:layout-master-set>

       <fo:page-sequence master-reference="default-sequence">

               <fo:static-content flow-name="Header" font-family="Arial" font-size="10pt" color="white">

                       <fo:block>

               The header of the page is aligned on the bottom of fo:region-before.        

               </fo:block>

               </fo:static-content>

               <fo:static-content flow-name="Footer" font-family="Arial" font-size="10pt" color="white">

                       <fo:block>

                  The footer of the page is aligned on the top of fo:region-after.

                  The footer has the "precedence" attribute set.

               </fo:block>

               </fo:static-content>

               <fo:static-content flow-name="LeftMargin" font-family="Arial" font-size="10pt" color="white">

                       <fo:block>

                  This is the left margin of the page. The region is rotated 90

                  degrees, and the content is vertically aligned on the bottom.

               </fo:block>

               </fo:static-content>

               <fo:static-content flow-name="RightMargin" font-family="Arial" font-size="10pt">

                       <fo:block>

                  This is the right margin of the page. The region is rotated -90

                  degrees, and the content is vertically aligned on the bottom.

               </fo:block>

               </fo:static-content>

               <fo:flow flow-name="Content" font-family="Arial Narrow" font-size="10pt" text-align="justify">

                       <fo:block>

                       The body region's content flows in two columns.

                       ...............................................        

                       The body region's content flows in two columns.

               </fo:block>

                       <fo:block span="all" border="1pt solid red" padding="2pt" space-before="3pt" space-after="3pt" start-indent="2pt" end-indent="2pt">

                       This block has "span" attribute set to all, which will make

                       it span all the columns in the page. Note that span attribute

                       can be set only for those blocks with a fo:flow as the direct        

                       parent.

               </fo:block>

                       <fo:block>

                       The body region's content flows in two columns.

                       ...............................................                        

                       The body region's content flows in two columns.

               </fo:block>

               </fo:flow>

       </fo:page-sequence>

</fo:root>

 

 

 

Output:

 

regions

 

 

Every sequence of pages generated by the XSL-FO engine can have one or more page layouts associated with it:

 

a) The simples scenario: only one page layout for the whole document. All documents described so far belong to this category.

b) Different page layouts for the first and subsequent pages, for the case when the user desires a cover page formatted differently than the rest of the pages.

c) Different page layouts for even and odd pages, as it happens with most printed books, where the inside margin of a page is slightly larger than the outside margin, to allow binding.