每第 n 页打印一些东西
Print something every nth page
我正在制作一份文件,该文件将自动包裹在信封中。
为此,文档需要每 5 页和最后一页标记一个标记。
问题是 AFAIK,XSL 不能依赖 FO 提供的 < fo:page >。
谁能想出解决办法?
我能做的最好的事情还需要您在 fo:page-sequence-master
中进行足够的重复以处理最大页数。
为了截图更小,本例在每三页和最后一页打上标记:
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
font-size="36pt">
<fo:layout-master-set>
<fo:simple-page-master master-name="spm" page-width="5in" page-height="5in">
<fo:region-body margin="36pt"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="marked" page-width="5in" page-height="5in">
<fo:region-body margin="36pt"/>
<fo:region-start extent="36pt"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="psm">
<fo:repeatable-page-master-alternatives maximum-repeats="2">
<fo:conditional-page-master-reference master-reference="marked" page-position="last"/>
<fo:conditional-page-master-reference master-reference="spm"/>
</fo:repeatable-page-master-alternatives>
<fo:single-page-master-reference master-reference="marked"/>
<fo:repeatable-page-master-alternatives maximum-repeats="2">
<fo:conditional-page-master-reference master-reference="marked" page-position="last"/>
<fo:conditional-page-master-reference master-reference="spm"/>
</fo:repeatable-page-master-alternatives>
<fo:single-page-master-reference master-reference="marked"/>
<!-- Repeat as often as necessary. -->
<fo:repeatable-page-master-alternatives maximum-repeats="2">
<fo:conditional-page-master-reference master-reference="marked" page-position="last"/>
<fo:conditional-page-master-reference master-reference="spm"/>
</fo:repeatable-page-master-alternatives>
<fo:single-page-master-reference master-reference="marked"/>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="psm">
<fo:static-content flow-name="xsl-region-start">
<fo:block margin-top="2in"><fo:external-graphic width="100%" src="logo-antenna.svg" content-width="scale-down-to-fit"/></fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block break-after="page">1</fo:block>
<fo:block break-after="page">2</fo:block>
<fo:block break-after="page">3</fo:block>
<fo:block break-after="page">4</fo:block>
<fo:block>5</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
我正在制作一份文件,该文件将自动包裹在信封中。
为此,文档需要每 5 页和最后一页标记一个标记。
问题是 AFAIK,XSL 不能依赖 FO 提供的 < fo:page >。
谁能想出解决办法?
我能做的最好的事情还需要您在 fo:page-sequence-master
中进行足够的重复以处理最大页数。
为了截图更小,本例在每三页和最后一页打上标记:
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
font-size="36pt">
<fo:layout-master-set>
<fo:simple-page-master master-name="spm" page-width="5in" page-height="5in">
<fo:region-body margin="36pt"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="marked" page-width="5in" page-height="5in">
<fo:region-body margin="36pt"/>
<fo:region-start extent="36pt"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="psm">
<fo:repeatable-page-master-alternatives maximum-repeats="2">
<fo:conditional-page-master-reference master-reference="marked" page-position="last"/>
<fo:conditional-page-master-reference master-reference="spm"/>
</fo:repeatable-page-master-alternatives>
<fo:single-page-master-reference master-reference="marked"/>
<fo:repeatable-page-master-alternatives maximum-repeats="2">
<fo:conditional-page-master-reference master-reference="marked" page-position="last"/>
<fo:conditional-page-master-reference master-reference="spm"/>
</fo:repeatable-page-master-alternatives>
<fo:single-page-master-reference master-reference="marked"/>
<!-- Repeat as often as necessary. -->
<fo:repeatable-page-master-alternatives maximum-repeats="2">
<fo:conditional-page-master-reference master-reference="marked" page-position="last"/>
<fo:conditional-page-master-reference master-reference="spm"/>
</fo:repeatable-page-master-alternatives>
<fo:single-page-master-reference master-reference="marked"/>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="psm">
<fo:static-content flow-name="xsl-region-start">
<fo:block margin-top="2in"><fo:external-graphic width="100%" src="logo-antenna.svg" content-width="scale-down-to-fit"/></fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block break-after="page">1</fo:block>
<fo:block break-after="page">2</fo:block>
<fo:block break-after="page">3</fo:block>
<fo:block break-after="page">4</fo:block>
<fo:block>5</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>