Search code examples
c#pdfsharpdrawstringright-to-leftpersian

PdfSharp XGraphics.DrawString not working for Right-To-Left Languages like Persian


I'm working with PdfSharp to create some pdf files. Everything works fine except when I try to put some text into the file in a right-to-left language (e.g., Persian) using Drawstring method. Although I choose Unicode encoding in XPdfFontOptions and a suitable font family (e.g., "B Nazanin"), it draws the letters discretely.

Here is an image of what I get.

B.T.W, is there any better way to create pdf files?


Solution

  • iTextSharp is a better choice for RTL languages. You can find a tutorial about it here.