如何在 A4 页面中创建边框和使用 fo:block 圆角 - XSL-FO

How to create border in A4 page and fo:block rounded corner in using - XSL-FO


如何在A4页面中创建边框和如何制作圆角fo:block

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
        <fo:layout-master-set>
            <fo:simple-page-master master-name="A4" page-height="11.40in" page-width="8.27in" margin-top="0.30in" margin-bottom=".030in" margin-left="0.30in" margin-right="0.30in">
                <fo:region-body region-name="body" margin=".30in"/>
            </fo:simple-page-master>
        </fo:layout-master-set>
        <fo:page-sequence master-reference="A4">
            <fo:flow flow-name="body">
                <fo:block text-align="center" border="1pt" border-style="solid">
                    How to create rounded border
                </fo:block>
            </fo:flow>
        </fo:page-sequence>
    </fo:root>

fo:region-body 可以有边框属性。参见 https://www.w3.org/TR/xsl11/#fo_region-body


圆角不在 XSL 1.1 推荐中。但是,您的 XSL 格式化程序可能有圆角扩展:

我已经通过 FOP 2.5 测试了以下 XSL-FO 文件。

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="A4" page-height="11.40in" page-width="8.27in" margin-top="0.30in" margin-bottom=".030in" margin-left="0.30in" margin-right="0.30in">
      <fo:region-body region-name="body" margin=".30in"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="A4">
    <fo:flow flow-name="body">
      <fo:block text-align="center" border="1pt" border-style="solid" fox:border-radius="10pt 15pt">
        Hello Word!
      </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

[输出快照]

[示例 command-line]

[氧气转化场景]

[带有 FOP 2.3 构建结果的氧气 21.1]