在当前的XSL-FO Master-Flow声明中,我的body部分溢出了我的页脚。
w.write("<fo:simple-page-master master-name="main-master" ");
w.write("page-height="11in" page-width="8.5in" margin-top=".5in" ");
w.write("margin-bottom=".5in" margin-left=".5in" margin-right=".5in">");
//w.write("<fo:region-body margin-top="20mm" margin-bottom="4in"/>");
w.write("<fo:region-body margin-top="25mm" margin-bottom="1in" space-after="1.5in"/>");
w.write("<fo:region-before extent="13mm"/>");
w.write("<fo:region-after region-name="footer" extent="0mm"/>");
w.write("</fo:simple-page-master>");
根据这个问题的建议,我试着调整了margin-bottom和region-after的范围,但无济于事。以前的margin-bottom设置为4英寸来防止这种情况(因为我的页面主体底部需要大的图像),但这会在每个页面的底部造成一个难看的大空白空间。太空后似乎也没有帮助。
如何防止我的xsl-fo文本的主体溢出到我的页脚?
您可以使用fo:static-content
元素来引用您的region-after
页脚。参见下面的示例:
<xsl:template name="Main" match="/">
<fo:page-sequence master-reference="main-master" >
<fo:static-content flow-name="footer">
<xsl:call-template name="MyFooter"/>
</fo:static-content>
<fo:flow>
...
</fo:flow>
</fo:page-sequence>
</xsl:template>
From W3Schools:
对象包含静态内容(例如header)和页脚),将在许多页面上重复。
对象有一个"flow-name"属性用来定义对象的内容存放的位置