2

According to the Formatting Object documentation the region-start (the region to the left of the body) spans between region-before (the header) and region-after (the footer), but when I generate a PDF with FOP (v1.1) region-start will begin at the top of the page and will push the region-before to the right.

So, is there any attribute or anything that makes the generator to place the region-start to begin below region-before?

Here is some example code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
        <fo:layout-master-set>
            <fo:simple-page-master master-name="A4-cover"
                page-width="210mm" page-height="297mm" margin="12mm">
                <fo:region-body margin-top="60mm" margin-left="85mm" />
                <fo:region-before extent="55mm" />
                <fo:region-start extent="80mm" />
            </fo:simple-page-master>
        </fo:layout-master-set>

        <fo:page-sequence master-reference="A4-cover">
            <fo:static-content flow-name="xsl-region-before">
                <fo:block background-color="blue">
                    Before area
                </fo:block>
            </fo:static-content>

            <fo:static-content flow-name="xsl-region-start">
                <fo:block background-color="red">
                    Start area
                </fo:block>
            </fo:static-content>

            <fo:flow flow-name="xsl-region-body">
                <fo:block background-color="green">
                    Body area
                </fo:block>
            </fo:flow>
        </fo:page-sequence>
    </fo:root>
</xsl:template>
</xsl:stylesheet>   
4

1 回答 1

3

First I thought that it should work as you expected it by default.

But it turns out that precedence="true" must be set on region-before to get the wanted behaviour (preventing region-start from extending into the corner). See http://www.w3.org/TR/xsl11/#precedence.

It is not very clearly stated in the XSL-FO specification, but as I understand it precedence only applies to region-before and region-after.

Here is a mailing list thread with a discussion of the topic: http://apache-fop.1065347.n5.nabble.com/page-layout-bug-td8766.html.

于 2013-02-06T17:13:50.170 回答