PDFsharp-net6

XTextFormatter

Namespace: PdfSharp.Drawing.Layout

Represents a very simple text formatter. If this class does not satisfy your needs on formatting paragraphs, I recommend taking a look at MigraDoc Foundation. Alternatively, you should copy this class in your own source code and modify it.

public class XTextFormatter

Inheritance ObjectXTextFormatter

Properties

Text

Gets or sets the text.

public string Text { get; set; }

Property Value

String
The text.

Font

Gets or sets the font.

public XFont Font { get; set; }

Property Value

XFont

LayoutRectangle

Gets or sets the bounding box of the layout.

public XRect LayoutRectangle { get; set; }

Property Value

XRect

Alignment

Gets or sets the alignment of the text.

public XParagraphAlignment Alignment { get; set; }

Property Value

XParagraphAlignment

Constructors

XTextFormatter(XGraphics)

Initializes a new instance of the XTextFormatter class.

public XTextFormatter(XGraphics gfx)

Parameters

gfx XGraphics

Methods

DrawString(String, XFont, XBrush, XRect)

Draws the text.

public void DrawString(string text, XFont font, XBrush brush, XRect layoutRectangle)

Parameters

text String
The text to be drawn.

font XFont
The font.

brush XBrush
The text brush.

layoutRectangle XRect
The layout rectangle.

DrawString(String, XFont, XBrush, XRect, XStringFormat)

Draws the text.

public void DrawString(string text, XFont font, XBrush brush, XRect layoutRectangle, XStringFormat format)

Parameters

text String
The text to be drawn.

font XFont
The font.

brush XBrush
The text brush.

layoutRectangle XRect
The layout rectangle.

format XStringFormat
The format. Must be XStringFormat.TopLeft