Arabic text not showing correctly in aspose export to pdf

image.png (1.7 KB)

The text is shown like the attachment. Please guide on how to fix it. The same text shows correctly on the webpage.

code is below:

foreach (Segment seg in text.Segments)
{

                if (HasArabicCharacters(seg.Content))
                {
                    seg.TextInfo.IsRightToLeft = true;
                    seg.TextInfo.IsUnicode = true;
                    seg.TextInfo.FontName = "Times New Roman";

                    isRelatedtoArabic = true;
                    if (!ignoreArabicContent)
                        seg.TextInfo.Alignment = AlignmentType.Right;
                }
                else
                {
                    seg.TextInfo.FontName = "Garamond";
                }
            }

seg.content has:

"<table style=“border: currentColor; border-collapse: collapse;” border=“1” cellSpacing=“0” cellPadding=“0”> <td width=“197” vAlign=“top” style=“padding: 0in 5.4pt; border: 1pt solid windowtext; width: 2.05in; background-color: transparent;”>

<span style=“font-family: Calibri,serif; font-size: 14pt;” dir=“RTL”>فظوملا <span style=“font-family: Calibri,serif; font-size: 14pt;”> <span dir=“RTL”>مسإ

<td width=“197” vAlign=“top” style=“border-width: 1pt 1pt 1pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext rgb(0, 0, 0); padding: 0in 5.4pt; width: 2.05in; background-color: transparent;”>

<span style=“font-family: Calibri,serif; font-size: 14pt;” dir=“RTL”>يفيظولا <span style=“font-family: Calibri,serif; font-size: 14pt;”> <span dir=“RTL”>مقرلا

<td width=“197” vAlign=“top” style=“border-width: 1pt 1pt 1pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext rgb(0, 0, 0); padding: 0in 5.4pt; width: 2.05in; background-color: transparent;”>

<span style=“font-family: Calibri,serif; font-size: 14pt;” dir=“RTL”>طابترإلا <span style=“font-family: Calibri,serif; font-size: 14pt;”> <span dir=“RTL”>مقر

<td width=“197” vAlign=“top” style=“border-width: 0px 1pt 1pt; border-style: none solid solid; border-color: rgb(0, 0, 0) windowtext windowtext; padding: 0in 5.4pt; width: 2.05in; background-color: transparent;”>

<font face=“Calibri”>67

<td width=“197” vAlign=“top” style=“border-width: 0px 1pt 1pt 0px; border-style: none solid solid none; border-color: rgb(0, 0, 0) windowtext windowtext rgb(0, 0, 0); padding: 0in 5.4pt; width: 2.05in; background-color: transparent;”>

<font face=“Calibri”>87686

<td width=“197” vAlign=“top” style=“border-width: 0px 1pt 1pt 0px; border-style: none solid solid none; border-color: rgb(0, 0, 0) windowtext windowtext rgb(0, 0, 0); padding: 0in 5.4pt; width: 2.05in; background-color: transparent;”>

<font face=“Calibri”>78786

<td width=“197” vAlign=“top” style=“border-width: 0px 1pt 1pt; border-style: none solid solid; border-color: rgb(0, 0, 0) windowtext windowtext; padding: 0in 5.4pt; width: 2.05in; background-color: transparent;”>

<font face=“Calibri”>6786

<td width=“197” vAlign=“top” style=“border-width: 0px 1pt 1pt 0px; border-style: none solid solid none; border-color: rgb(0, 0, 0) windowtext windowtext rgb(0, 0, 0); padding: 0in 5.4pt; width: 2.05in; background-color: transparent;”>

<font face=“Calibri”>766

<td width=“197” vAlign=“top” style=“border-width: 0px 1pt 1pt 0px; border-style: none solid solid none; border-color: rgb(0, 0, 0) windowtext windowtext rgb(0, 0, 0); padding: 0in 5.4pt; width: 2.05in; background-color: transparent;”>

<font face=“Calibri”>7868

"

@sajjadalikk

Thanks for contacting support.

In order to display correct language characters in PDF document, please use font which supports specific language characters. Also, would you please share complete code snippet, which is able to replicate the issue in any environment including input files (if any). Please also make sure to use latest version of the API before sharing the requested data. We will test the scenario in our environment and address it accordingly.