How to display Arabic strings from RTL in PDF generated using itext 7 API?

可紊 提交于 2019-11-28 14:20:44

Step 1: load pdfCalligraph and licensekey jars into your classpath

Step 2: load license key from xml file:

LicenseKey.loadLicenseFile("itextkey-typography.xml");

Step 3: Create your Document as usual:

Document document = new Document(new PdfDocument(new PdfWriter(outFileName)));

PdfFont bf = PdfFontFactory.createFont(ARABIC_FONT, PdfEncodings.IDENTITY_H);
document.setFont(bf);

document.add(new Paragraph(ARABIC_TEXT).setTextAlignment(TextAlignment.RIGHT));

document.close();
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!