英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论