我使用fop Quick Start Guide從簡單的XML文件打印簡單的PDF文件,它工作正常。但是當我將<name>Frank</name>
更改爲<name>امیررضا</name>
(將名稱更改爲其他編碼)時,我在打印的PDF中獲得####
。我通過互聯網搜索,沒有找到任何可行的解決方案。我在這裏使用的許多配置文件是我的一些配置文件:我不能改變我的字體家庭使用Apache FOP
我使用這個命令來創建PDF:
fop -c cfg.xml -xml name.xml -xsl name2fo.xsl -pdf name.pdf
當我使用這個命令,我得到以下警告:
WARNING: xHeight value could not be determined. The font may not work as
Sep 15, 2011 9:15:37 AM org.apache.fop.events.LoggingEventListener proce
WARNING: Glyph "╙" (0x633, afii57427) not available in font "Helvetica".
Sep 15, 2011 9:15:37 AM org.apache.fop.events.LoggingEventListener proce
WARNING: Glyph "╘" (0x634, afii57428) not available in font "Helvetica".
1 - name.xml的包含:
<name>امیررضا</name>
2 name2fo.xsl包含:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="A4-portrait"
page-height="29.7cm" page-width="21.0cm" margin="2cm">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4-portrait">
<fo:flow flow-name="xsl-region-body">
<fo:block>
Hello, <xsl:value-of select="name"/>!
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
3-已嘗試許多不同的配置文件(cfg.xml)。
3.1:
<fop version="1.0">
<renderers>
<renderer mime="application/pdf">
<fonts>
<substitutions>
<substitution>
<from font-family="Helvetica" />
<to font-family="SansSerif"/>
</substitution>
</substitutions>
<referenced-fonts>
<match font-family=".*"/>
</referenced-fonts>
<!-- register all the fonts found in a directory and all of its sub directories (use with care) -->
<directory recursive="true">G:\....\fop\fop-1.0\Core14_AFMs</directory>
<!-- automatically detect operating system installed fonts -->
<auto-detect/>
<font embed-url="C:\WINDOWS\Fonts\times.ttf">
<font-triplet name="Times New Roman" style="normal" weight="normal"/>
</font>
</fonts>
</renderer>
</renderers>
</fop>
3.2:
<fop version="1.0">
<renderers>
<renderer mime="application/pdf">
<fonts>
<substitutions>
<substitution>
<from font-family="Helvetica" />
<to font-family="SansSerif"/>
</substitution>
</substitutions>
<referenced-fonts>
<match font-family=".*"/>
</referenced-fonts>
<!-- automatically detect operating system installed fonts -->
<auto-detect/>
</fonts>
</renderer>
</renderers>
</fop>
3.3:......
結果輸出爲:
您好,### ####!
任何人都可以幫助我解決這個問題嗎?
Tanx爲您提供幫助。但是我自己看到了這個鏈接,問題在於java org.apache.fop.fonts.apps.TTFReader C:\ Iqraa.ttf Iqraa.xml在fop 1.0中不支持,並且通過異常沒有fin主類:(;據我瞭解和閱讀在APache Fop官方主頁這silution是爲FOP版本.9和更少。 – Am1rr3zA