XSL-FO 页面布局

[color=red]奇偶页[/color]


<?xml version="1.0"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="even"
page-height="297mm" page-width="210mm"
margin-top="20mm" margin-bottom="20mm"
margin-left="25mm" margin-right="25mm">
<fo:region-body margin-bottom="20mm"/>
<fo:region-after region-name="footer-even" extent="20mm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="odd"
page-height="297mm" page-width="210mm"
margin-top="20mm" margin-bottom="20mm"
margin-left="25mm" margin-right="25mm">
<fo:region-body margin-bottom="20mm"/>
<fo:region-after region-name="footer-odd" extent="20mm"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="document">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference odd-or-even="even"
master-reference="even"/>
<fo:conditional-page-master-reference odd-or-even="odd"
master-reference="odd"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="document">
<fo:static-content flow-name="footer-even">
<fo:block text-align="start"><fo:page-number/></fo:block>
</fo:static-content>
<fo:static-content flow-name="footer-odd">
<fo:block text-align-last="end"><fo:page-number/></fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block/>
<fo:block break-before="page"/>
</fo:flow>
</fo:page-sequence>
</fo:root>


[color=red]封面和余页[/color]


<?xml version="1.0"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="first"
page-height="297mm" page-width="210mm"
margin-top="20mm" margin-bottom="20mm"
margin-left="25mm" margin-right="25mm">
<fo:region-body margin-bottom="20mm"/>
<fo:region-after region-name="footer-first" extent="20mm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="rest"
page-height="297mm" page-width="210mm"
margin-top="20mm" margin-bottom="20mm"
margin-left="25mm" margin-right="25mm">
<fo:region-body margin-bottom="20mm"/>
<fo:region-after region-name="footer-rest" extent="20mm"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="document">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="first"
master-reference="first"/>
<fo:conditional-page-master-reference page-position="rest"
master-reference="rest"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="document">
<fo:static-content flow-name="footer-first">
<fo:block text-align="center">First page.</fo:block>
</fo:static-content>
<fo:static-content flow-name="footer-rest">
<fo:block text-align-last="center">Other page.</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block/>
<fo:block break-before="page"/>
<fo:block break-before="page"/>
</fo:flow>
</fo:page-sequence>
</fo:root>


注1:
在多页的情况下,xsl-region-body 的 fo:block-container, 不能position="absolute",这样rest pages不会打印
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值