itext PDF - 希腊字母未出现在生成的PDF文档中 [英] itext PDF - Greek letters are not appearing in the resulting PDF document

查看:630
本文介绍了itext PDF - 希腊字母未出现在生成的PDF文档中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难用itextpdf来生成包含希腊字母的PDF文件。我从外部源读取字符串作为UTF-8字符串。英语字母出现在结果中,但不出现在希腊语中。搜索问题,我认为它可能与使用的字体有关。我不知道什么ttf文件使用,如果这是问题。
下面是创建字体的方法

I am having hard time trying to generate PDF files containing Greek letters using itextpdf. I am reading the strings from an external source as UTF-8 strings. English letters appear in results but not the Greek ones. Searching for the problem, I think it might be related to the font used. I do not know what ttf file to use if this is the problem. Here is how am creating the font


BaseFont bfTimes =
BaseFont.createFont(FontFactory.HELVETICA,UTF -8,
BaseFont.EMBEDDED);
Font times = new Font(bfTimes,12,Font.BOLD);

BaseFont bfTimes = BaseFont.createFont(FontFactory.HELVETICA,"UTF-8", BaseFont.EMBEDDED); Font times = new Font(bfTimes, 12, Font.BOLD);

任何帮助, p>

any help is heartily appreciated!

推荐答案

您需要使用具有希腊字符的字体。
您可以在此处找到Greek unicode字体。

You need to use a font that has Greek characters in it. You may find Greek unicode fonts here.

您可以查看此处的示例关于使用itext的作者的unicode字体。

You can check an example here on using unicode fonts from the author of itext.

这篇关于itext PDF - 希腊字母未出现在生成的PDF文档中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆