XSL-FO footer on last page

和自甴很熟 提交于 2019-12-31 03:56:08

问题


I have an XSL-FO file with a header and footer.

I added static content for the header and footer, but I want the footer to only display on the last page.

How can I do this?

<?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>

回答1:


Within <fo:layout-master-set>, you can define a page sequence:

<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>

Then you can define a simple-page-master for the last page, which contains a region-after that only appears on this page.

Tutorial



来源:https://stackoverflow.com/questions/19374508/xsl-fo-footer-on-last-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!