Itext7 PDFCalligraph module not working as expected for Indic Font

1.9k Views Asked by At

I am using itext7 PDFCalligraph module to render Hindi font in pdf through a java web application. I have acquired a trial license key for this after registering and it is loading also correctly. But complex hindi letters are not rendering as expected which was supposed to be the case after using the Calligraph module. Pl. help. Code snippet given below..

com.itextpdf.licensekey.LicenseKey.loadLicenseFile ("E:\\licensekeys\\itextkey-0.xml");

PdfFont fontHindi = PdfFontFactory.createFont("E:\\Devanagari_New\\FreeSans.ttf", PdfEncodings.IDENTITY_H);

cellpay = new Cell().add(new Paragraph("\u0915\u093e\u0930\u092a\u093e\u0930\u094d\u0915\u093f\u0902\u0917")
            .setFont(fontHindi)
            .setFontColor(new DeviceRgb(50, 205, 50)));
tablew.addCell(cellpay);

Thanks all for your inputs. I had indeed forgotten to load the callipgraph dependency , had loaded only the license module dependency. Thanks for your pointers.

1

There are 1 best solutions below

0
On

Did you remember to add pdfCalligraph as a dependency to your product? Is the output the same with and without the license loaded (it shouldn't be, but if it is, you might not have added the dependency).

When added as a dependency and loaded in, together with a valid license, pdfCalligraph will do its work silently in the background. When it is not added as a dependency, no exceptions will be thrown (even if a valid license is loaded), so it's sometimes hard to tell if you did it correctly without looking at output.