简体   繁体   English

XSL-FO中的HTML编码字母

[英]HTML encoded letters in XSL-FO

I am using XSLT to transform XML to XSL-FO and then create PDF from it (using Apache FOP ). 我正在使用XSLT将XML转换为XSL-FO,然后从中创建PDF(使用Apache FOP )。 Unfortunately I have HTML encoded letters in XML like: 不幸的是,我有XML编码的HTML字母,例如:

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

How can I have Ł instead of &#322; 我该如何用Ł代替&#322; in my output PDF? 在我的输出PDF中?

It seems that configuration of FOP is not properly set. 似乎未正确设置FOP的配置。 Edit or duplicate the file fop.xconf that you will find in the conf folder within your FOP installation directory. 编辑或复制文件fop.xconf ,该文件将在FOP安装目录下的conf文件夹中找到。

In this file, locate the <renderer mime="application/pdf"> tag. 在此文件中,找到<renderer mime="application/pdf">标记。 Inside the <fonts> child tag, add <auto-detect/> . <fonts>子标记内,添加<auto-detect/> You should obtains a <renderer> configuration like this (I have removed all the commented text): 您应该获得这样的<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>

Then you should invoke the fop command with the -c option, eg 然后,您应该使用-c选项调用fop命令,例如

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

And it should work properly (assuming the font face can properly render the specific character). 并且它应该可以正常工作(假设字体可以正确呈现特定字符)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM