arabic encoding in itextsharp

南楼画角 提交于 2019-12-01 22:47:02

Right-to-left writing and Arabic ligatures are only supported in ColumnText and PdfPTable!

Take a look at the following examples:

Read the book from which these examples are taken to find out why not all words are rendered correctly in peace.pdf

Search http://tinyurl.com/itextsharpIIA2C11 for the corresponding C# version of these examples.

In any case, you need a font that knows how to display Arabic glyphs:

BaseFont bf = BaseFont.CreateFont(ARIALUNI_TFF, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font f = new Font(bf, 12);

You can now add Arabic text, for instance in a table:

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