我试图用fop打印多个页面

时间:2017-05-10 10:40:03

标签: xslt xsl-fo apache-fop

我正在尝试使用此代码添加多个页面。每个页面的内容都是个性化的。我找了一个关于如何添加多个页面的例子,但我来的每个人都没有为我工作。我在这里犯了一些错误吗?如果有些人可以添加我需要用于页面的基本结构,那将非常有用。

 <?xml version="1.0" encoding="UTF-8" ?>
<fo:root
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"    
    font-family="Freesans">
    <fo:layout-master-set>
        <fo:simple-page-master master-name="standard"
                               page-height="15.2cm"
                               page-width="8.1cm"
                               margin-top="1cm"
                               margin-bottom="1cm"
                               margin-left="1.5cm"
                               margin-right="1.5cm">
            <fo:region-body   margin-top="1cm"/>
           </fo:simple-page-master>
 <fo:simple-page-master master-name="rest"
                               page-height="15.2cm"
                               page-width="8.1cm"
                               margin-top="1cm"
                               margin-bottom="1cm"
                               margin-left="1.5cm"
                               margin-right="1.5cm">
            <fo:region-body   margin-top="1cm"/>

           </fo:simple-page-master>
<fo:page-sequence-master master-name="standard">
<fo:repeatable-page-master-reference master-name="rest"/>
</fo:page-sequence-master>
</fo:layout-master-set>

    <fo:page-sequence master-reference="standard"  force-page-count="no-force">
<fo:flow flow-name="xsl-region-body" font-size="8pt">
          <fo:block text-align="right" >
              <fo:page-number/> / <fo:page-number-citation ref-id="totalPages"/>
          </fo:block>
       <!--content-->
<fo:block id="totalPages"></fo:block>
        </fo:flow>
          </fo:page-sequence>

<fo:page-sequence master-reference="rest"  force-page-count="no-force">
    <fo:flow flow-name="xsl-region-body" font-size="8pt">
          <fo:block text-align="right" >
              <fo:page-number/> / <fo:page-number-citation ref-id="totalPages"/>
          </fo:block>
         <!--content-->
       <fo:block id="totalPages"></fo:block>
        </fo:flow>
   </fo:page-sequence> 
</fo:root>

0 个答案:

没有答案