一个区块中的多个内联容器 - 无法让它们突破到下一页

时间:2018-05-21 10:19:09

标签: xsl-fo antenna-house

我使用内联容器来渲染一系列图像。我的源文件有5个段落,每个段落包含1个图像。

<para stylename="Numbered Figure">
    <image file="P_1568.pdf" width="7.90cm" height="12cm"/>
</para>

我有一个A4页面,其中两张图片并排放置,另外两张放在上面。

我的FO:

<xsl:when test="@stylename = 'Numbered Figure'">
    <fo:block widows="1" orphans="1">
      <fo:inline-container width="descendant::image/@width">
        <fo:external-graphic src="descendant::image/@file">
        <fo:block-container>
             code for placing a number in the top left corner of the image
        </fo:block-container> 
    </fo:inline-container>
  <fo:block>

这是结果:内联容器不会换行到下一页,但溢出页面。
enter image description here

这看起来像5个内联容器被视为一个单词,所以我尝试在每个内联容器之间添加一个空格:

</fo:inline-container><fo:inline><xsl:text> </xsl:text></fo:inline>

这导致图像4和5包装到第二页,而不是我在第一页上有图像1-4的意图。空间太宽,图像3 + 4 +空间不适合一条线 我尝试使用零宽度空间(U + 200B),但随后图像再次回到第1页溢出。

到目前为止,我所尝试的一切都没有成功:

  • 在每个内联容器
  • 之后添加一个包含空格字符的fo:inline
  • 指定widows =&#34; 1&#34;孤儿=&#34; 1&#34;在包含fo:block

我的目标是将图像5换行到第二页。是否有一个属性我可以设置允许两个内联容器之间的中断?

(我需要内联容器,因为我将文本元素放在每个图像的顶部)。 使用Antennahouse Formatter。

编辑: 这可能是Antennahouse Formatter中的一个问题。当我的源包含7张图像时,图像放置正确(第1页上有4张图像,第2页上有3张图像)。

1 个答案:

答案 0 :(得分:1)

widowsorphans都设置为1,以便该块可以中断并在下一页上只放一行。

<fo:block widows="1" orphans="1">
    <fo:inline-container width="7.90cm" height="12cm">
        <fo:block><fo:external-graphic src="ah-logo.svg" /></fo:block>
    </fo:inline-container>
    <fo:inline-container width="7.90cm" height="12cm">
        <fo:block><fo:external-graphic src="ah-logo.svg" /></fo:block>
    </fo:inline-container>
    <fo:inline-container width="7.90cm" height="12cm">
        <fo:block><fo:external-graphic src="ah-logo.svg" /></fo:block>
    </fo:inline-container>
    <fo:inline-container width="7.90cm" height="12cm">
        <fo:block><fo:external-graphic src="ah-logo.svg" /></fo:block>
    </fo:inline-container>
    <fo:inline-container width="7.90cm" height="12cm">
        <fo:block><fo:external-graphic src="ah-logo.svg" /></fo:block>
    </fo:inline-container>
</fo:block>