We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to draw a Unicode characters in PDF document in ASP.NET Core platform?

Platform: ASP.NET Core |
Control: PDF
Tags: pdf, fonts, unicode

You can render Unicode text by adding custom fonts in .NET Core PDF document by using PdfTrueTypeFont instance in ASP.NET core platform. Refer the below code example for further details.

 

 
//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 = _hostingEnvironment.WebRootPath + "/Font/Arial.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@#% unicode test%3^*", tFont, PdfBrushes.Black, Syncfusion.Drawing.PointF.Empty);
 
MemoryStream ms = new MemoryStream();
 
//Save the PDF document 
document.Save(ms);
 
//Close the dococument 
document.Close(true);
 

 

Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/WebApplication-1079519555

 

2X faster development

The ultimate ASP.NET Core UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile