使用 fop1.1 ,我正在尝试使用本节fop 中间格式中讨论的中间文件方法打印文档
问题是它在第三步打印了一个空白页。
这是我用于测试的 FO 文件:
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xml.apache.org/fop/extensions">
<fo:layout-master-set>
<fo:simple-page-master master-name="all" page-height="5.4cm" page-width="9.56cm" margin-top="0cm" margin-bottom="0cm" margin-left="0cm" margin-right="0cm">
<fo:region-body margin-top="0cm" margin-bottom="0cm" background-color="transparent" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="all">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:block-container absolute-position="absolute" top="5px" left="11px" height="30px" width="300px" overflow="hidden">
<fo:block font-weight="normal" font-style="italic" font-family="Arial">852147</fo:block>
</fo:block-container>
<fo:block-container absolute-position="absolute" top="50px" left="10px" height="30px" width="300px" overflow="hidden">
<fo:block font-weight="bold" font-style="normal" font-family="Arial" font-size="10pt">nabil</fo:block>
</fo:block-container>
<fo:block-container absolute-position="absolute" top="100px" left="10px" height="30px" width="300px" overflow="hidden">
<fo:block font-weight="bold" font-style="normal" font-family="Arial" font-size="10pt">madara</fo:block>
</fo:block-container>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
配置文件
<?xml version="1.0"?>
<!-- $Id: fop.xconf 1339442 2012-05-17 01:42:56Z gadams $ -->
<!-- NOTE: This is the version of the configuration -->
<fop version="1.1">
<fonts>
<auto-detect/>
</fonts>
<!-- Strict user configuration -->
<strict-configuration>true</strict-configuration>
<!-- Strict FO validation -->
<strict-validation>true</strict-validation>
<!-- Base URL for resolving relative URLs -->
<base>.</base>
<!-- Font Base URL for resolving relative font URLs -->
<font-base>./</font-base>
<source-resolution>72</source-resolution>
<target-resolution>72</target-resolution>
<default-page-settings height="11in" width="8.26in"/>
<renderers>
<renderer mime="application/pdf">
<filterList>
<!-- provides compression using zlib flate (default is on) -->
<value>flate</value>
</filterList>
<fonts>
<auto-detect/>
</fonts>
</renderer>
</renderers>
</fop>
脚步 :
fop -c cfg.xml -fo myfile.fo -at application/pdf myfile.at.xml
fop -c cfg.xml -atin myfile.at.xml -pdf myfile.pdf
(pdf文件生成正确)fop -atin myfile.at.xml -print
(使用pdf创建器打印空白页)