简体   繁体   中英

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 ). Unfortunately I have HTML encoded letters in XML like:

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

How can I have Ł instead of &#322; in my output PDF?

It seems that configuration of FOP is not properly set. Edit or duplicate the file fop.xconf that you will find in the conf folder within your FOP installation directory.

In this file, locate the <renderer mime="application/pdf"> tag. Inside the <fonts> child tag, add <auto-detect/> . You should obtains a <renderer> configuration like this (I have removed all the commented text):

<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

 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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