You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Matthew Van Horn <ho...@accesstech.com> on 2002/10/25 08:02:55 UTC

headers and footers

Can someone give me an example of how to use the region-before and 
region-after regions as headers and footers? I am trying, but they keep 
overlapping the content, no matter what combinations of 
extents/margins/display-aligns I use.

It is a simple document consisting of two pages. Each page should be 
(limited to) a single page, but they should use a common header and 
footer.

Right now I have this: (and both header and footer are overlapping the 
content)
		<fo:root
			font-family="Times"
			font-size="12pt">
			<fo:layout-master-set>
			<!-- A4 size -->
				<fo:simple-page-master
					page-width="21cm"
					page-height="29.7cm"
					margin-top="4cm"
					margin-bottom="4cm"
					margin-left="4cm"
					margin-right="4cm"
   					master-name="only">
					<fo:region-body region-name="xsl-region-body"/>
					<fo:region-before  region-name="xsl-region-before"
						background-color="#00FF00"
						display-align="before"
						 extent="8cm"/>
					<fo:region-after  region-name="xsl-region-after"
						background-color="#0000ff"
						display-align="after"
						 extent="2cm"/>
				</fo:simple-page-master>
				
				<fo:page-sequence-master
					   master-name="single-page">
					<fo:single-page-master-reference
						master-name="single"
						master-reference="only"/>
				</fo:page-sequence-master>
				
			</fo:layout-master-set>

			<fo:page-sequence master-reference="single-page">
				<fo:static-content flow-name="xsl-region-before" 
padding-after="1cm">
					<fo:block>
						...header content...
					</fo:block>
				</fo:static-content>
				<fo:static-content
					flow-name="xsl-region-after">
					<fo:block
						text-align="center"
						font-size="6pt">... footer content...					</fo:block>
				</fo:static-content>
				<fo:flow
					flow-name="xsl-region-body">
					<fo:block>...main content...</fo:block>
				</fo:flow>
			</fo:page-sequence>
			...second page omitted...
		</fo:root>


Re: headers and footers

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Matthew Van Horn wrote:
> Can someone give me an example of how to use the region-before and 
> region-after regions as headers and footers? I am trying, but they keep 
> overlapping the content, no matter what combinations of 
> extents/margins/display-aligns I use.

Regions can overlap. You have to specifically choose the margins
of the region-body if you want avoid this:
    <fo:region-before  region-name="xsl-region-before"
       extent="8cm"/>
    <fo:region-after  region-name="xsl-region-after"
       extent="2cm"/>
    <fo:region-body region-name="xsl-region-body"
       margin-top="8cm" margin-bottom="2cm"/>

The display-alignment has absolutely nothing to do with margins
or overlapping.

J.Pietschmann


RE: headers and footers

Posted by Victor Mote <vi...@outfitr.com>.
Matthew Van Horn wrote:

> Can someone give me an example of how to use the region-before and
> region-after regions as headers and footers? I am trying, but they keep
> overlapping the content, no matter what combinations of
> extents/margins/display-aligns I use.
...
> Right now I have this: (and both header and footer are overlapping the
> content)
...
> 					<fo:region-body
> region-name="xsl-region-body"/>
> 					<fo:region-before
> region-name="xsl-region-before"
> 						background-color="#00FF00"
> 						display-align="before"
> 						 extent="8cm"/>

Add a margin-top attribute to your region-body element. It is probably
defaulting to 0, which is putting it into the same space as your
region-before. You will want to make it at least as big as your extent
attribute in your region-before element. Your footer issue is similar.

Victor Mote