2015-04-23 43 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 

它應該可以正常工作(假設字體可以正確呈現特定字符)。