所以我有这种情况:我正在使用天线屋从xml/xsl生成pdf。问题是生成的 pdf 包含多个 N 个文档,每个文档包含 X 页。打印时,如果文档以奇数页结束,则必须在文档末尾插入空白页,以便下一个文档在新纸上开始。为此,我使用:force-page-count="end-on-even",但插入的空白页有一个页码,我不想显示,因为页面上没有内容。这是 xsl 部分:
<xsl:template match="document">
<fo:page-sequence master-reference="myDoc" initial-page-number="1" force-page-count="end-on-even" >
<fo:static-content flow-name="xsl-region-after" font-size="8pt" font-family="Arial" >
<fo:block>
<fo:block text-align="right" margin-right="10mm">
<fo:inline text-align="right">
Page: <fo:page-number /> of <fo:page-number-citation-last ref-id="{generate-id(.)}"/>
</fo:inline>
</fo:block>
<xsl:variable name="footervar" select=".//footertxt" /> <!-- Gets text betwen <footertxt> tags in XML file -->
<fo:block text-align="left" margin-left="15mm">
<fo:inline>
<xsl:value-of select="$footervar" />
</fo:inline>
</fo:block>
</fo:block>
</fo:static-content>
</fo:page-sequence>
</xsl:template>
xml部分如下所示:
<document>
<footertxt> </footertxt>
<section>
<paragraf>1</paragraf>
</section>
</document>
<document>
<footertxt> </footertxt>
<section>
<paragraf>2</paragraf>
</section>
<pagebreak />
<section>
<paragraf>3</paragraf>
</section>
</document>
任何想法如何从空白页中删除页码? 谢谢
设置一个包含多个fo:conditional-page-master-reference
(https://www.w3.org/TR/xsl11/#fo_conditional-page-master-reference) 的fo:repeatable-page-master-alternatives
(https://www.w3.org/TR/xsl11/#fo_repeatable-page-master-alternatives) 的fo:page-sequence-master
(https://www.w3.org/TR/xsl11/#fo_page-sequence-master)。 第一个fo:conditional-page-master-reference
可以具有blank-or-not-blank="blank"
并引用没有fo:xsl-region-after
的fo:simple-page-master
。
更简单地说,您可以执行以下操作:
<fo:simple-page-master master-name="BlankPage"
page-height="265mm"
page-width="215mm">
<fo:region-body region-name="blank" />
</fo:simple-page-master>
...
<fo:page-sequence-master master-name="myDoc">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="BlankPage"
blank-or-not-blank="blank" />
<fo:conditional-page-master-reference master-reference="OddPage"
odd-or-even="odd" />
<fo:conditional-page-master-reference master-reference="EvenPage"
odd-or-even="even" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>