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.

Sat Feb 15, 2020 8:34 pm

Hi

I have followed your tutorial (with the free library) to fill in a Arabic PDF form with Arabic content.

When I open the saved PDF , the field content write split character like مرحبا it write م ر ح ب ا .

What am I doing wrong?

Saif

saifamer29
 
Posts: 2
Joined: Sat Feb 15, 2020 8:24 pm

Mon Feb 17, 2020 2:15 am

Hello,

Sorry for the late reply as weekend.
I simulated a PDF file and tested your scenario but didn't reproduce your issue. To help us further investigate it, please provide the following information.
1) Your input file, your testing code as well as your output file.
2) Your testing environment information, such as OS information (E.g. Windows 7, 64bit) and Region setting (E.g. China, Chinese).

You could attach them here or send them to us(support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed Feb 19, 2020 10:01 am

Hello,

Greetings from E-iceblue!
How is your issue now? Could you please provide more information to help us further look into your issue?
Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Thu Feb 27, 2020 9:39 am

rachel.lei wrote:Hello,

Greetings from E-iceblue!
How is your issue now? Could you please provide more information to help us further look into your issue?
Thanks in advance.

Sincerely,
Rachel
E-iceblue support team


Dear sir,
thanks for your replay
look this sub of code i use :

Code: Select all
 PdfDocument doc = new PdfDocument();
            PdfUnitConvertor unitCvtr = new PdfUnitConvertor();
            PdfMargins margin = new PdfMargins();
            margin.Top = unitCvtr.ConvertUnits(2.54f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
            margin.Bottom = margin.Top;
            margin.Left = unitCvtr.ConvertUnits(3.17f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
            margin.Right = margin.Left;
            PdfPageBase page = doc.Pages.Add(PdfPageSize.A4, margin);
            float y = 10;
            PdfBrush brush1 = PdfBrushes.Black;
            PdfTrueTypeFont font1 = new PdfTrueTypeFont(new Font("./Alef-Regular.ttf", 16f, FontStyle.Bold), true);
            PdfStringFormat format1 = new PdfStringFormat() { RightToLeft = true, Alignment = PdfTextAlignment.Center };
            page.Canvas.DrawString("دول العالم", font1, brush1, page.Canvas.ClientSize.Width / 2, y, format1);
            y = y + font1.MeasureString("دول العالم", format1).Height;
            y = y + 5;
            String[] data
    = {
        "الاسم;العاصمه;الدوله;المنطقه;تعداد السكان",
        "Argentina;Buenos Aires;South America;2777815;32300003",
        "Bolivia;La Paz;South America;1098575;7300000",
        "Brazil;Brasilia;South America;8511196;150400000",
        "Canada;Ottawa;North America;9976147;26500000",
        };
            String[][] dataSource
                = new String[data.Length][];
            for (int i = 0; i < data.Length; i++)
            {
                dataSource[i] = data[i].Split(';');
            }
            PdfTable table = new PdfTable();
            table.Style.CellPadding = 2;
            table.Style.HeaderSource = PdfHeaderSource.Rows;
            table.Style.HeaderRowCount = 1;
            table.Style.ShowHeader = true;
            table.DataSource = dataSource;
            table.Style.HeaderStyle.Font = new PdfTrueTypeFont(new Font("./Alef-Regular.ttf", 16f, FontStyle.Bold), true);
            table.Style.HeaderStyle.StringFormat = new PdfStringFormat() { RightToLeft = true, Alignment = PdfTextAlignment.Center };
            PdfLayoutResult result = table.Draw(page, new PointF(0, y));
            y = y + result.Bounds.Height + 5;
            PdfBrush brush2 = PdfBrushes.Gray;
            PdfTrueTypeFont font2 = new PdfTrueTypeFont(new Font("./Alef-Regular.ttf", 16f, FontStyle.Bold), true);
            page.Canvas.DrawString(String.Format("* {0} countries in the list.", data.Length - 1), font2, brush2, 5, y);

            doc.SaveToFile("SimpleTable.pdf");
            doc.Close();


and this is the result i get

saifamer29
 
Posts: 2
Joined: Sat Feb 15, 2020 8:24 pm

Thu Feb 27, 2020 10:18 am

Hello,

Thanks for your sharing.
I tested your code with the latest Spire.PDF Pack(Hot Fix) Version:6.2.6 but didn't reproduce your issue. Attached is my output PDF file.
If you were using an old version, please try again with the latest version. If the issue still happens, please provide your testing environment information, such as OS information (E.g. Windows 7, 64bit) and Region setting (E.g. China, Chinese) for further investigation.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri Mar 06, 2020 6:44 am

Hello,

Hope you are doing well.
Have you tested the latest Spire.PDF? Did it solve your issue?
Thanks in advance for your feedback.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Tue Jun 15, 2021 4:36 pm

Hello,

Sorry to resurrect a very old thread, but I'm having the same problem.
Help will be greatly appreciated.

Environment
- Spire.Pdf (7.6.1) for .NET (Latest available on NuGet)
- Visual Studio 2019 latest update
- Windows 10 latest update

Code
Code: Select all
            const string value = "أهلا وسهلا";
                       
            var doc = new PdfDocument();
            var page = doc.Pages.Add(PdfPageSize.A4, new PdfMargins());
            var font = new PdfTrueTypeFont(new Font("Alef-Regular.ttf", 36f, FontStyle.Bold), true);
            var labelBounds = new RectangleF(20, 20, 400, font.Height);
            page.Canvas.DrawString(value, font, PdfBrushes.Black, labelBounds, new PdfStringFormat() { RightToLeft = true });

            doc.SaveToFile("result3.pdf");


Output PDF
Please find it attached.

Repro Solution
Please find it attached.

ahmad.akra
 
Posts: 2
Joined: Tue Jun 15, 2021 12:12 pm

Wed Jun 16, 2021 6:59 am

Hello,

Thanks for your inquiry.
Regarding the font "Alef", the way you used to create a PdfTrueTypeFont object is incorrect, you can refer to the following ways to set the font. However, it should be reminded that "Alef" font does not support these characters you added.
Code: Select all
            //Method1: Need to install the corresponding font in your system
            var font = new PdfTrueTypeFont(new Font("Alef", 16f, FontStyle.Bold), true);

            //Method2: Don’t need to install the corresponding font in your system
            var font = new PdfTrueTypeFont("Fonts/Alef-Regular.ttf", 16f);


As for the font "Noto Naskh Arabic", we did find that the content of the generated PDF is inconsistent with the input string. I have logged it in our bug tracking system with the ticket SPIREPDF-4390. If there is any update, we will let you know. Apologize for the inconvenience caused.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Tue Sep 14, 2021 8:16 am

rachel.lei wrote:Hello,

Hope you are doing well.
Have you tested the latest Spire.PDF? Did it solve your issue?
Thanks in advance for your feedback.

Sincerely,
Rachel
E-iceblue support team


Hello, I have a same problem with separate characters in that table. Thank you in advance!

Environment
- FreeSpire.Pdf (7.8.9) in .NET Core application
- Windows 10 latest update
- Russian Region

l_evve_l
 
Posts: 1
Joined: Tue Sep 14, 2021 7:22 am

Tue Sep 14, 2021 10:17 am

Hello l_evve_l,

Thanks for your inquiry.
I tested your case in a similar environment and did reproduce your issue. I have logged it in our bug tracking system with the ticket SPIREDOC-6700. If there is any update, we will let you know. Apologize for the inconvenience caused.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF