2015-04-23 47 views
0

我使用XSLT将XML转换为XSL-FO,然后使用它创建PDF(使用Apache FOP)。不幸的是我已经HTML编码XML封样:XSL-FO中的HTML编码字母

<TAG>wp&#322;yw</TAG> 

我怎么能有Ł,而不是&#322;在我的输出PDF?

+0

也许这可以帮助你:http://stackoverflow.com/questions/17956218/xsl-fo-foreign-characters-polish-unicode-in-apache-fop-v-1-1 – potame

+0

它似乎正常工作。什么是你想使用的字体(Arial,Helvetica,...)?你检查它是否安装在你的电脑上? – potame

+0

@potame我试过Arial和Times。他们都安装。 – alex

回答

0

看来FOP的配置没有正确设置。编辑或复制文件fop.xconf,您可以在您的FOP安装目录中的conf文件夹中找到该文件。

在此文件中,找到<renderer mime="application/pdf">标记。在<fonts>子标签内,添加<auto-detect/>。 你应该获得一个<renderer>配置是这样的(我已删除了所有的注释文本):

<renderer mime="application/pdf"> 
    <filterList> 
    <!-- provides compression using zlib flate (default is on) --> 
    <value>flate</value> 

    <!-- encodes binary data into printable ascii characters (default off) 
     This provides about a 4:5 expansion of data size --> 
    <!-- <value>ascii-85</value> --> 

    <!-- encodes binary data with hex representation (default off) 
     This filter is not recommended as it doubles the data size --> 
    <!-- <value>ascii-hex</value> --> 
    </filterList> 

    <fonts> 
    <!-- ... lots of commented stuff in here ... --> 

    <auto-detect/> 

    </fonts> 
</renderer> 

那么你应该用-c选项,例如调用FOP命令

fop -c path/to/file/fop.xconf myfile.fo myfileout.pdf 

它应该可以正常工作(假设字体可以正确呈现特定字符)。