javaitexttruetypeembedded-fontspdfa

iText PDF A-2 with English and Hindi Fonts


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?


Solution

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