Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Sep 06, 2022 3:05 pm

i have used FreeSpire.PDF 8.6.0
vs2022
and c# 7
its working well for english language but when i write persian/arabic words show disjointed word like bellow
" علیرضا" -->
"ع ل ی ر ض ا"
is there anyway to fix this problem?

hadih3pn
 
Posts: 1
Joined: Tue Sep 06, 2022 2:52 pm

Wed Sep 07, 2022 6:51 am

Hello hadih3pn,

Thanks for your inquiry.
I used the following code to test your case, but I did not reproduce the problem you mentioned. I have attached my test document for your reference. If your testing code is different, you can share it with us for further testing, and please share your system information (E.g. Win10, 64 bit) and region setting (E.g. China, Chinese).
Code: Select all
            PdfDocument doc = new PdfDocument();
            //Create one page
            PdfPageBase page = doc.Pages.Add();
            string headerText = "علیرضا";
            //Define style
            PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arabic", 10f, FontStyle.Regular), true);
            PdfBrush brush = PdfBrushes.Red;
            RectangleF rect = new RectangleF(new PointF(0, 20), new SizeF(doc.PageSettings.Size.Width, 50f));
            PdfStringFormat format = new PdfStringFormat();
            format.Alignment = PdfTextAlignment.Center;
            format.RightToLeft = true;
            doc.Pages[0].Canvas.DrawString(headerText, font, brush, rect, format);
            string output = @"Output.pdf";
            //Save the document
            doc.SaveToFile(output);


Sincerely,
Simple
E-iceblue support team
User avatar

Simple.Li
 
Posts: 248
Joined: Fri Jul 01, 2022 2:33 am

Return to Spire.PDF