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 draw the complex scripts in PDF document?

How to draw complex scripts in PDF document?

 

Complex scripts can be rendered in PDF document by converting the string to path using GraphicsPath class in a specified points.

 

Note: The rendered complex text cannot be selectable or searchable.

 

Please refer to the following code example how to draw complex scripts in PDF document:

 

C#:

//Create a new document

PdfDocument doc = new PdfDocument();

//Add a new page

PdfPage page = doc.Pages.Add();

PdfPen pen = PdfPens.Black;

PdfBrush brush = PdfBrushes.Black;

//Initialize the Font

System.Drawing.FontFamily font = new System.Drawing.FontFamily("Vrinda");

string text = "স্লামালিকুম স্লামালিকুম স্লামালিকুম স্লামালিকুম স্লামালিকুম স্লামালিকুম স্লামালিকুম স্লামালিকুম স্লামালিকুম স্লামালিকুম";

//Create instance for Graphics Path

GraphicsPath path1 = new GraphicsPath();

//Pass the margin value for which you need to contain the text in it.

RectangleF layoutRectangle = new RectangleF(0, 0, 250, 200);

//Draw within the margin.

path1.AddString(text, font, 1, 12, layoutRectangle, 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 the PDF Document

doc.Save("Sample.pdf");

doc.Close(true);

 

 

Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfSample1296419947

 

Article ID: Published Date: Last Revised Date: Platform: Control:
5996 01/19/2016 01/19/2016 Windows Forms PDF
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.