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.
Unfortunately, activation email could not send to your email. Please try again.

How to render the complex scripts (Hindi) text in PDF ?

How to render the complex scripts (Hindi) text in PDF properly?

 

To preserve the Hindi complex scripts in PDF document, we can use the GraphicsPath class to convert the string to path and can draw this path in PDF using PdfPath at specified points.

Please refer to the following code example how to draw the Hindi text in PDF document:

C#:

 

//Create a new document

PdfDocument doc = new PdfDocument();

doc.PageSettings.Margins.All = 0;

//Add a new page

PdfPage page = doc.Pages.Add();

PdfPen pen = PdfPens.Black;

PdfBrush brush = PdfBrushes.Black;

//Initialize the font

FontFamily font = new FontFamily("Arial Unicode MS");

 

//Create an instance for graphics path

GraphicsPath path1 = new GraphicsPath();

path1.AddString("मेरा नाम है दिनेश", font, 1, 12, new Point(10, 10), new StringFormat());

PointF[] points = path1.PathPoints;

byte[] pathTypes = path1.PathTypes;

 

//Draw the path in PDF document

PdfPath drawPath = new PdfPath(pen, points, pathTypes);

page.Graphics.DrawPath(brush, drawPath);

path1.Dispose();

font.Dispose();

//Save and close the document

doc.Save("Sample.pdf");

doc.Close(true);

 

 

Sample Link:

http://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfSample386079411.zip

Article ID: Published Date: Last Revised Date: Platform: Control:
5852 12/12/2015 12/12/2015 Windows Forms PDF
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.