在 XSL FO (FOP) 中添加不带标题的附加文本页面

问题描述 投票:0回答:1

我无法解决一个问题。我需要在 XSL FO(在 FOP 中)中的文档末尾添加更多页面,但没有页眉和页脚。

我将打印发票。我为第一页定义了一个简单页面主控,为所有其他页面定义了另一个简单页面主控。到目前为止,一切顺利。

但是,我需要选择打印附加页面,其中包含条款和条件,一个简单的长文本,又将是几页,但我不希望这些页面上有任何标题,并且我需要文本从这些页面的顶部。

我完全不知道如何创建一个额外的(第三个)简单页面主控,其中我不会定义任何标题,或者更确切地说,我不知道如何仅针对条款和条件页面调用它:(

我希望我写清楚了。有人可以帮忙吗?非常感谢。

例如:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="first-page" margin="1in">
      <fo:region-body margin-top="15mm"/>        
      <fo:region-before extent="10mm" region-name="xsl-region-before-first-page"/>
    </fo:simple-page-master>
    <fo:simple-page-master master-name="other-pages" margin="1in">
      <fo:region-body margin-top="15mm"/>        
      <fo:region-before extent="10mm" region-name="xsl-region-before-other-pages"/>
    </fo:simple-page-master>   
    <fo:page-sequence-master master-name="main-master">
      <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference master-reference="first-page" page-position="first"/>
        <fo:conditional-page-master-reference master-reference="other-pages"/>          
      </fo:repeatable-page-master-alternatives>        
    </fo:page-sequence-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="main-master">
    <fo:static-content flow-name="xsl-region-before-first-page">
      <fo:block font-size="36pt" background-color="#ff0000">Header for the first page</fo:block>
    </fo:static-content>
    <fo:static-content flow-name="xsl-region-before-other-pages">
      <fo:block font-size="36pt" background-color="#0000ff">Header for other pages</fo:block>
    </fo:static-content>
    <fo:flow flow-name="xsl-region-body">
      <!-- rows of document -->
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>

      <!-- add some pages with texts -->
      <fo:block page-break-before="always" />
      <fo:block font-size="36pt">Some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text</fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

这是 PDF:

带有标题的文档.pdf

我所需要的是,在页面上,“一些其他文本,一些 其他文本...”是,不会是标题:(

xsl-fo apache-fop
1个回答
0
投票

为“一些其他文本,一些其他文本......”创建一个新的

fo:page-sequence

新的

fo:static-content
中没有任何
fo:page-sequence
,因此没有任何内容可以定向到页面的外部区域。

如果您希望这些页面具有不同的边距,请创建一个新的

fo:simple-page-master
(或新的
fo:page-sequence-master
以及它将使用的
fo:simple-page-master
)并让新
master-reference
fo:page-sequence
引用它。

您创建的新

fo:simple-page-master
只需要一个具有正确边距的
fo:region-body
。不需要
fo:region-before
等,因为这些页面上没有标题。

© www.soinside.com 2019 - 2024. All rights reserved.