admin管理员组

文章数量:1391982

We are using iText7 and itext7.pdfcalligraph to render the Kurdish characters. Some of the characters are not rendered as expected.

Code used:

Document arabicPdf = new Document(new PdfDocument(new PdfWriter("output.pdf")));

arabicPdf.SetBaseDirection(BaseDirection.RIGHT_TO_LEFT);
arabicPdf.SetFontScript(iText.Commons.Utils.UnicodeScript.ARABIC);
// Arabic text starts near the top right corner of the page
arabicPdf.SetTextAlignment(TextAlignment.RIGHT);
// create a font, and make it the default for the document
PdfFont f = PdfFontFactory.CreateFont(@"D:\Font\arial.ttf", 
iText.IO.Font.PdfEncodings.IDENTITY_H);
arabicPdf.SetFont(f);
// add content: (as-salaamu ‘aleykum - peace be upon you)
arabicPdf.Add(new Paragraph("تۆماری نمرەی کارگێری وئەنجامی تاقیکردنەوە"));
arabicPdf.Close();

Current output:

Expected output:

Can anyone help me to resolve this problem.

本文标签: pdfiText7 Kurdish characters rendering issueStack Overflow