使用 apache FOP 的 PDF 生成中的印度货币符号 (₹)



>我正在尝试生成一个PDF文件,其中包含带有金额及其货币符号的发票详细信息。

但是,当我将印度货币符号 (( 写入 XML 文件时,我的输出在 PDF 文件中仅显示#。 日本货币符号 (¥( 也会出现同样的问题。

我的 XML :

<invoice-detail>
<invoice-number>sample001</invoice-number>
<invoice-amount>₹50,00,000</invoice-amount>
</invoice-detail>

我的 XSL :

<fo:block font-size="10pt" font-family="sans-serif" padding-top="3pt">
<xsl:value-of select="invoice-amount"></xsl:value-of>
</fo:block>

我们使用Apache FOP通过xml和xsl文件生成PDF文件,也使用jasperreports-fonts(6.8.0(作为字体样式,并将这些字体映射到fop.xconf文件中。

您需要指定支持字体系列中字符的 true 类型字体。或者,您可以为单个字符指定它。

<fo:inline font-family="Symbol">&#8377;</fo:inline>

如果您的字体已经能够显示字符,请使用字符代码而不是字符本身。

您的代码应如下所示:

<invoice-detail>
<invoice-number>sample001</invoice-number>
<invoice-amount>₹50,00,000</invoice-amount>
</invoice-detail>

=&#8377;

¥=&#65509;

https://xmlgraphics.apache.org/fop/faq.html#pdf-characters

最新更新