我遇到了Apache FOP 1.0的问题
PDF文件创建没有问题,但如果我尝试创建中文PDF,我得到的只是“#”,中文字母应该是。错误就像是
WARN org.apache.fop.events.LoggingEventListener:80 - 字形“?” (0x6ee4)字体“Helvetica”中没有。
我的.fo看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="Arial Unicode MS,Verdana,sans-serif">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="1.5cm" margin-bottom="1.5cm" margin-left="1.5cm" margin-right="1.5cm">
<fo:region-body margin-top="3.2cm" background-color="#F8EC00" />
<fo:region-before background-color="#F8EC00" />
<fo:region-after display-align="after" background-color="#F8EC00" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:static-content flow-name="xsl-region-before">
<fo:table table-layout="fixed" text-align="left" background-color="#F8EC00" >
<fo:table-column column-width="12.6cm"/>
<fo:table-column column-width="3.6cm"/>
<fo:table-body>
<fo:table-row keep-together.within-page="always">
<fo:table-cell padding="0.4cm">
<fo:block text-align="left" font-size="16pt" font-weight="bold" color="#007D4E" >
曼牌滤清器
</fo:block>
<fo:block font-size="18pt" font-weight="bold" color="#007D4E" margin-top="0.5cm">
WK 69
</fo:block>
</fo:table-cell>
....
我错过了什么?
答案 0 :(得分:1)
请参阅http://xmlgraphics.apache.org/fop/faq.html#pdf-characters
上的Apache FOP常见问题解答答案 1 :(得分:0)
事实上,字体“Helvetica”不支持中文字符。您需要使用字体文件,如MS Arial Unicode作为unicode字符