在fo之前<xsl:output omit-xml-declaration="yes" method="html" encoding="GB2312"/>

解决方案 »

  1.   

    这个问题有点复杂,竟然给那么少分,那么就简单的讲,呵呵
    例如用宋体,你要用java org.apache.fop.fonts.apps.TTFReader C:\WINNT\Fonts\simun.ttf simun.xml
    来产生simsun.xml文件,然后改conf/下的user*.xml(记不清了),render的时候指定配置文件,ok
      

  2.   

    http://www-900.ibm.com/developerWorks/cn/xml/x-fop/index.shtml我不要分。
      

  3.   

    我的验证结论:
    1)建立font metrics文件:
    对于后缀为ttf的TrueType字体文件:
    >java -cp build\fop.jar org.apache.fop.fonts.apps.TTFReader C:\WINNT\Fonts\simkai.ttf simkai.xml
    对于后缀为ttc的字体文件:
    >java -cp build\fop.jar org.apache.fop.fonts.apps.TTFReader -ttcname "SimSun" C:\WINNT\Fonts\simsun.ttc  simsun.xml
    2)登记上述字体:
    在conf目录下找到userconfig.xml文件,编辑文件,在其<fonts></fonts>标记之间加入:
    <font metrics-file="simsun.xml" kerning="yes" embed-file="c:\WINNT\fonts\simsun.ttc">
        <font-triplet name="mysimsun" style="normal" weight="normal"/>
     </font>
     <font metrics-file="simkai.xml" kerning="yes" embed-file="c:\WINNT\fonts\simkai.ttf">
        <font-triplet name="mysimkai" style="normal" weight="normal"/>
     </font>
    保存文件。
    3)使用:
    只需要在参数中指定配置文件即可:
    >Fop -c <CFGFile> -xsl <XMLFile> -xml <XSLFile> -pdf <PDFFile> <回车>