PDF library: non english languages support

I am using the following demo but the application is unable to render russian text. Any input on what could be wrong? Does PDF library not support non-english languages? If it is not supported when can we expect support for the same? 

https://www.syncfusion.com/kb/10358/how-to-create-a-pdf-file-in-blazor-using-c



3 Replies 1 reply marked as answer

GK Gowthamraj Kumar Syncfusion Team May 10, 2021 01:35 PM UTC

Hi ajit, 
 
Thank you for contacting Syncfusion support. 
 
We have support for drawing the different text language in PDF document using our PDF library. To render the non english character, we have to use the proper custom fonts which should support all the characters. Please refer to the below link for more information.    
 
Please refer the below code snippet to render the Russian text in a PDF document, 
//Create a new PDF document 
            PdfDocument document = new PdfDocument(); 
 
            //Add a page to the document. 
            PdfPage page = document.Pages.Add(); 
 
            //Create PDF graphics for the page. 
            PdfGraphics graphics = page.Graphics; 
 
            string path = @"E:\ArialUnicode\arial-unicode-ms.ttf"; 
 
            Stream fontStream = new FileStream(path, FileMode.Open, FileAccess.ReadWrite); 
 
            //Create a new PDF true type font. 
            PdfTrueTypeFont tFont = new PdfTrueTypeFont(fontStream, 12, PdfFontStyle.Regular); 
 
            //Draw the text 
            graphics.DrawString("Sample  Привет мир", tFont, PdfBrushes.Black, Syncfusion.Drawing.PointF.Empty); 
 
            FileStream file = new FileStream("../../../OutputRussian.pdf", FileMode.Create, FileAccess.Write); 
 
            //Save the PDF document  
            document.Save(file); 
 
            //Close the dococument  
            document.Close(true); 
 
Note: The provided true type font should support the character to draw in PDF document.  
 
Please let us know if you need any further assistance with this.  
 
Regards, 
Gowthamraj K 


Marked as answer

AP Abhishek Purohit March 8, 2022 10:35 AM UTC

The same solution does not work for Hindi (and other Indian language) although it works (for hindi etc.) in .Net Framework WebForms but does not work in ASP.NET Core/.net6.0 web applications.



SV Surya Venkatesan Syncfusion Team replied to Abhishek Purohit March 9, 2022 07:11 PM UTC

Hi Abhishek,


We can draw the complex script language text such as Thai, Hindi, Tamil, Kannada and more in a PDF document by enabling the ComplexScript property available in PdfStringFormat class. We have attached the Net 6.0 sample for drawing the Hindi characters using our library, please try the sample on your end and let us know the result.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample6_076409139

Output: https://www.syncfusion.com/downloads/support/directtrac/general/pd/HindiCharacters576836894


Please refer to the below link for more information,

KB: https://www.syncfusion.com/kb/5996/how-to-draw-the-complex-scripts-in-a-pdf-document

UG: https://help.syncfusion.com/file-formats/pdf/working-with-text#drawing-complex-script-language-text

Please let us know if you need any further assistance in this.


Regards,

Surya V


Loader.
Up arrow icon