【问题标题】:XSL-FO footer on last page最后一页的 XSL-FO 页脚
【发布时间】:2013-10-15 06:21:09
【问题描述】:

我有一个带有页眉和页脚的 XSL-FO 文件。

我为页眉和页脚添加了静态内容,但我希望页脚仅显示在最后一页上。

我该怎么做?

<?xml version="1.0" encoding="ISO-8859-1"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
        <fo:simple-page-master master-name="A4" page-width="210mm" page-height="297mm" margin-top="1cm" margin-bottom="1cm"
                               margin-left="1cm" margin-right="1cm">
            <fo:region-body margin-top="90mm" margin-bottom="80mm"/>
            <fo:region-before extent="90mm"/>
            <fo:region-after extent="80mm"/>
            <fo:region-start/>
            <fo:region-end/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="A4">
        <fo:static-content flow-name="xsl-region-before">
            <fo:block>
                <fo:external-graphic src="images/logo.png" content-width="scale-to-fit" height="50mm"/>
            </fo:block>
        </fo:static-content>
        <fo:static-content flow-name="xsl-region-after">
            <fo:block>
                <fo:external-graphic src="images/signature.gif" content-width="scale-to-fit" height="50mm"/>
            </fo:block>
        </fo:static-content>
        <fo:flow flow-name="xsl-region-body">
            ...
        </fo:flow>
    </fo:page-sequence>
</fo:root>

【问题讨论】:

    标签: static footer xsl-fo


    【解决方案1】:

    &lt;fo:layout-master-set&gt;内,可以定义一个页面序列:

    <page-sequence-master master-name="pages">
      <repeatable-page-master-alternatives>
        <conditional-page-master-reference page-position="last" master-reference="last-page"/>
        <conditional-page-master-reference master-reference="other-page"/>
      </repeatable-page-master-alternatives>
    </page-sequence-master>
    

    然后你可以为最后一页定义一个simple-page-master,它包含一个只出现在这个页面上的region-after。

    Tutorial

    【讨论】:

    • 您可以点击我的答案旁边的复选标记,表示它解决了您的问题...
    • 教程是理解这篇文章的关键。谢谢你的链接。
    猜你喜欢
    • 2015-12-18
    • 2012-07-28
    • 1970-01-01
    • 1970-01-01
    • 2011-12-29
    • 2021-09-19
    • 1970-01-01
    • 2021-04-24
    • 2016-04-14
    相关资源
    最近更新 更多