Apache™ FOP (Formatting Objects Processor) is a print formatter driven by XSL formatting objects (XSL-FO) and an output independent formatter. It is a Java application that reads a formatting object (FO) tree and renders the resulting pages to a specified output. Output formats currently supported include PDF, PS, PCL, AFP, XML (area tree representation), Print, AWT and PNG, and to a lesser extent, RTF and TXT. The primary output target is PDF.

问题处理

中文显示

  1. 自动检测系统字体库
    fop.xconf默认配置为自动检测。
    注意使用正确的字体家族名称。(可使用 Windows 自带字体查看器查询)
    WinFontViewer.png
    1
    2
    3
    4
    5
    <fo:block color="green" font-family="华文行楷">
    Hello, <xsl:value-of select="name"/>!
    <fo:external-graphic src="asf-logo.png"/>
    中文测试
    </fo:block>
  2. 添加自定义字体库
    在配置文件中注册字体fop.xconf
    可以任意定义字体名称font-triplet name="xxx" ,使用时与其保持一致即可。font-family="xxx"
    1
    2
    3
    <font kerning="yes" embed-url="HanBiaoLiXuKeShuFa.ttf">
    <font-triplet name="LiXuKeShuFa" style="normal" weight="normal"/>
    </font>

Apache™ FOP: Fonts

推荐用法

应用集成

Apache™ FOP: Embedding

事件处理

Apache™ FOP: Events/Processing Feedback

留言