0

我希望我的 FOP 为最后一页生成一个带有不同正文部分的 pdf。我试图像这样实现这种行为:

<xsl:template match="/fatture">
  <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

    <fo:layout-master-set>
      <fo:simple-page-master master-name="main" page-height="297mm" page-width="210mm"
                             margin-top="0mm" margin-bottom="5mm" margin-left="5mm" margin-right="5mm">
        <fo:region-body margin-top="110mm" margin-bottom="75mm"/>
        <fo:region-before extent="110mm"/>
        <fo:region-after extent="75mm"/>
      </fo:simple-page-master>

      <fo:simple-page-master master-name="main-other" page-height="297mm"
                             page-width="210mm" margin-top="0mm" margin-bottom="5mm" margin-left="5mm"
                             margin-right="5mm">
        <fo:region-body margin-top="110mm" margin-bottom="75mm"
                        region-name="xsl-region-body"/>
        <fo:region-before extent="110mm" region-name="xsl-region-before"/>
        <fo:region-after extent="75mm" region-name="xsl-region-footer"/>
      </fo:simple-page-master>
      <fo:simple-page-master master-name="main-last" page-height="297mm"
                             page-width="210mm" margin-top="0mm" margin-bottom="5mm" margin-left="5mm"
                             margin-right="5mm">
        <fo:region-body margin-top="110mm" margin-bottom="75mm"
                        region-name="xsl-region-body-last"/>
        <fo:region-before extent="110mm" region-name="xsl-region-before"/>
        <fo:region-after extent="75mm" region-name="xsl-region-footer"/>
      </fo:simple-page-master>

      <fo:page-sequence-master master-name="sintetica">
        <fo:repeatable-page-master-alternatives>
          <fo:conditional-page-master-reference master-reference="main-last" 
                                                page-position="last"/>
          <fo:conditional-page-master-reference master-reference="main-last"/>
        </fo:repeatable-page-master-alternatives>
      </fo:page-sequence-master>

    </fo:layout-master-set>
    <xsl:for-each select="fattura">
      <fo:page-sequence master-reference="sintetica">
        <xsl:call-template name="main-document.header"/>
        <xsl:call-template name="main-document.footer"/>
        <xsl:call-template name="main-document.body"/>
        <xsl:call-template name="main-document-last.body"/>
      </fo:page-sequence>
    </xsl:for-each>

    <!--        
    -->
  </fo:root>
</xsl:template>

但是我认为在页面序列部分有一个错误,因为我尝试调用 2 个不同的主体。错误是:

流 'xsl-region-body' 不映射到页面主 'main-last' 中的区域主体。FOP 目前不支持这一点。

知道如何解决我的问题吗?如果我在页面序列中使用flow标签,我可以声明 2 body 吗?

4

1 回答 1

0

您的第一个 fo:conditional-page-master-reference 中有一个错字 - 两个主引用属性都设置为“main-last” - 这是否解决了问题?

此外,也许这个其他问题已经提供了一个合适的答案?链接: 如何检测文档的最后一页?

于 2012-11-28T16:49:49.260 回答