iText 是 pdf 中的 deforming/misspelling 个 Unicode 字符
iText is deforming/misspelling Unicode characters in pdf
我正在尝试使用基本上包含 Unicode 字符的 iText v2.1.5 生成 pdf,Ariel 是用于相同的字体。现在的问题是一些字符,如 "Hindi" 和 "Gujarati" 字符在正确生成时遇到问题。请查看下面的屏幕截图以更好地了解问题。
图表中突出显示的字体和 Table 使用相同的字体,但 table 中的字体不适合印地语和古吉尔语字符。
Graph(融合图表)中突出显示的字符是使用 PhantomJS 生成的,并作为 png 图像嵌入到 pdf 中。下面 Table 中的字符与图表中使用的字符具有相同的 "Arial_Unicode_MS.ttf" 字体(在 linux 机器的 /usr/share/fonts/truetype/Arial_Unicode_MS.ttf 中可用),但是table 是使用 iText 生成的,我不明白为什么会导致这种意外行为。
我试过调试 phantomJS 并且我可以保证它使用与上面提到的相同的字体文件。请参考我在 iText 中的以下代码:
String formattedData="જિજ્ઞેશ";
BaseFont nationalBase = BaseFont.createFont("/usr/share/fonts/truetype/Arial_Unicode_MS.ttf", BaseFont.COURIER, BaseFont.NOT_EMBEDDED);
PdfPCell dataCell= new PdfPCell(new Phrase(8, new Chunk(formattedData, dataFont)));
为了检查问题是否是 iText 引起的,我尝试直接在 formattedData="જિજ્ઞેશ" 中使用 Unicode 字符,但 table 生成的字体仍然与我最初使用的有很大不同。
正如之前多次解释的那样,iText 5 不支持印地语。我们在 iText 7 中修复了此问题,并在 Great Indian Developer Summit.
在印度发布了该版本
iText 7 有一个特殊的附加组件,名为 pdfCalligraph and as soon as you plug in this add-on, Devaganari and Tamil will be rendered correctly. Please read Chapter 2 of "iText 7: Building Blocks" (please scroll towards the end of the chapter) to find out how the pdfCalligraph add-on works. You can get a free trial version of pdfCalligraph here。
目前支持天城文、泰米尔语和阿拉伯语。将应付费客户的要求添加对其他书写系统的支持。
我正在尝试使用基本上包含 Unicode 字符的 iText v2.1.5 生成 pdf,Ariel 是用于相同的字体。现在的问题是一些字符,如 "Hindi" 和 "Gujarati" 字符在正确生成时遇到问题。请查看下面的屏幕截图以更好地了解问题。
图表中突出显示的字体和 Table 使用相同的字体,但 table 中的字体不适合印地语和古吉尔语字符。
Graph(融合图表)中突出显示的字符是使用 PhantomJS 生成的,并作为 png 图像嵌入到 pdf 中。下面 Table 中的字符与图表中使用的字符具有相同的 "Arial_Unicode_MS.ttf" 字体(在 linux 机器的 /usr/share/fonts/truetype/Arial_Unicode_MS.ttf 中可用),但是table 是使用 iText 生成的,我不明白为什么会导致这种意外行为。
我试过调试 phantomJS 并且我可以保证它使用与上面提到的相同的字体文件。请参考我在 iText 中的以下代码:
String formattedData="જિજ્ઞેશ";
BaseFont nationalBase = BaseFont.createFont("/usr/share/fonts/truetype/Arial_Unicode_MS.ttf", BaseFont.COURIER, BaseFont.NOT_EMBEDDED);
PdfPCell dataCell= new PdfPCell(new Phrase(8, new Chunk(formattedData, dataFont)));
为了检查问题是否是 iText 引起的,我尝试直接在 formattedData="જિજ્ઞેશ" 中使用 Unicode 字符,但 table 生成的字体仍然与我最初使用的有很大不同。
正如之前多次解释的那样,iText 5 不支持印地语。我们在 iText 7 中修复了此问题,并在 Great Indian Developer Summit.
在印度发布了该版本iText 7 有一个特殊的附加组件,名为 pdfCalligraph and as soon as you plug in this add-on, Devaganari and Tamil will be rendered correctly. Please read Chapter 2 of "iText 7: Building Blocks" (please scroll towards the end of the chapter) to find out how the pdfCalligraph add-on works. You can get a free trial version of pdfCalligraph here。
目前支持天城文、泰米尔语和阿拉伯语。将应付费客户的要求添加对其他书写系统的支持。