iText PDF A-2带有英文和印地语字体

huangapple go评论113阅读模式
英文:

iText PDF A-2 with English and Hindi Fonts

问题

我正在使用 PdfAWriter 创建一个 PDF A-2 文件,如下所示:

PdfAWriter writer = PdfAWriter.getInstance(document, new FileOutputStream(dest), PdfAConformanceLevel.PDF_A_2A);

要添加文本,我使用 TTF 字体,像这样:

Font font8 = new Font(BaseFont.createFont(FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED), 8);

我需要创建一个包含英文和印地语字体的 PDF A-2 文件。对于英文,我使用 OpenSans-Regular.ttf,对于印地语,我可以使用 Kruti_Dev_010.ttf,但如果我使用 Kruti_Dev_010.ttf,英文内容就无法显示。

如何创建同时包含英文和印地语文本的 PDF 呢?

英文:

I am using PdfAWriter to create a PDF A-2 document as below

PdfAWriter writer = PdfAWriter.getInstance(document, new FileOutputStream(dest), PdfAConformanceLevel.PDF_A_2A);

For adding text I am using TTF fonts like this

Font font8 = new Font(BaseFont.createFont(FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED), 8);

I need to create a PDF A-2 file with both English and Hindi fonts. For English I use OpenSans-Regular.ttf and for Hindi I can use Kruti_Dev_010.ttf, but if I use Kruti_Dev_010.ttf it does not render anything in English.

How can I create a PDF with both English and Hindi text?

答案1

得分: 1

Google Fonts具有支持天城体脚本和基本拉丁字符的字体。

英文:

Google Fonts has fonts that support Devanagari script and also Basic Latin characters.

huangapple
  • 本文由 发表于 2020年5月29日 16:42:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/62081967.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定