SfPdfViewer doesnt display arab letters

Hi Syncfusion's team,

I migrate may application from Xamarin to .Net MAUI.

The problem is that SfPdfViewer doesnt display arab letters?

For example,

With these instructions I tempt display two texts 

            PdfGraphics graphics = page.Graphics;

            //Set the standard font.

            PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);

            //Draw the text.

            graphics.DrawString("السلام عليكم Hello", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));

In SfPdfViewer, the text "Hello" is displayed but the text  "السلام عليكم" is not.

Thanks you in advance.



3 Replies

BS Bharathi Selvam Syncfusion Team March 4, 2025 05:17 PM UTC

Hi Cosyspro,

Thank you for reaching out to us.

The issue you're experiencing is not related to the PDF Viewer but rather to the PDF creation process. Specifically, the problem arises because the PdfStandardFont does not support Arabic text. The PdfStandardFont class in Syncfusion relies on the 14 core PDF fonts defined by the PDF specification, such as Helvetica, Times-Roman, and Courier. Unfortunately, these standard fonts lack the capability to handle complex scripts like Arabic, which require proper glyph shaping and bidirectional (right-to-left) text processing.

Due to these requirements, PdfStandardFont cannot accurately render Arabic text. Therefore, it is essential to use PdfTrueTypeFont with a font that contains Arabic glyphs, such as Arial. By using PdfTrueTypeFont and providing a .ttf file, the font is embedded directly into the PDF. This ensures the document displays correctly across various devices, regardless of whether the Arial font is installed. This method is recommended to maintain font integrity and ensure consistent presentation in different environments.

We have prepared a sample that demonstrates how to generate a PDF with Arabic text and load it in PDF Viewer. In this sample, the Arial .ttf font file is included as an embedded resource. The font is accessed as a stream type, used to create the PDF with Arabic text, and then loaded into the PDF Viewer. We have attached the sample for your reference. Please review the sample and let us know if need further assistance.

For more detailed information, refer to the following user guides:

Regards,

Bharathi S


Attachment: PDFViewerDemo_75d5b216.zip


CO Cosyspro March 8, 2025 02:04 PM UTC

Hi Bharathi S,

Thanks for your help, It works



BS Bharathi Selvam Syncfusion Team March 11, 2025 04:19 AM UTC

Hi Cosyspro,

We’re glad to hear that it worked! Please feel free to reach out if you need any further assistance.

Regards,
Bharathi S


Loader.
Up arrow icon