Reputation: 77
XSize Si1 = gfx.MeasureString(student_Name.ToString(), fontbody2);
var height = Convert.ToInt32(Si1.Width);
var j3 = height / 150;
var j2 = (j3 * 20);
XRect rect1 = new XRect(135, x, 150, 150);
tf.DrawString(student_Name.ToString(), fontbody2, XBrushes.Black, rect1, XStringFormat.TopLeft);
The output come to new line but just based on spaces. It doesn't consider ',' for line break and goes beyond the scope.
Upvotes: 2
Views: 1641
Reputation: 21689
The XTextFormatter
class that comes with PDFsharp as a demo breaks lines at whitespace. In normal texts, a comma will be followed by a space and the line will break at the space.
If you have special needs, take the source code of the XTextFormatter class and adjust it to your needs.
Your code snippet is somewhat incomplete. From the variable name I assume you are using XTextFormatter.
Upvotes: 2