Hello,
Here is my code
PdfStringFormat format = new PdfStringFormat { Alignment = horizontalAlign, LineAlignment = verticalAlignment, LineLimit = false, WordWrap = isMultiline ? PdfWordWrapType.Word : PdfWordWrapType.None, NoClip = false, }; RectangleF rect = new RectangleF(textObject.X.Value, textObject.Y.Value, textObject.Width.Value, textObject.Height.Value);
if (backColorBrush != null) graphics.DrawRectangle(backColorBrush, rect); graphics.DrawString(text, font, foreColorBrush, rect, format);
|
as you see in my format initilizer, there is a scenario that WordWrap could be PdfWordWrapType.None. With this scenario, i need to horizontally align text withing the it's container when it has fixed width:
Let's say container width is 100(fixed ) and cannot be resized with text size and text size is bigger than container's width. Also WordWrap is set to PdfWordWrapType.None and cannot be changed, expected result:

Actaul result is always left aligned:

Is there a way to set it as my expected result?