Docotic.Pdf Library Help > BitMiracle.Docotic.Pdf > PdfCanvas Class > PdfCanvas Methods > DrawText Method > DrawText Method (String, RectangleF, PdfTextAlign, PdfVerticalAlign, Single)
Draws the specified text string in the specified rectangle using specified formatting options.

Namespace:  BitMiracle.Docotic.Pdf
Assembly:  BitMiracle.Docotic.Pdf (in BitMiracle.Docotic.Pdf.dll)

Syntax

C#
public int DrawText(
	string text,
	RectangleF rect,
	PdfTextAlign align,
	PdfVerticalAlign verticalAlign,
	float lineHeight
)
VB
Public Function DrawText ( 
	text As String,
	rect As RectangleF,
	align As PdfTextAlign,
	verticalAlign As PdfVerticalAlign,
	lineHeight As Single
) As Integer

Parameters

text
Type: System.String
The string to draw.
rect
Type: System.Drawing.RectangleF
The RectangleF structure that specifies the location of the drawn text.
align
Type: BitMiracle.Docotic.Pdf.PdfTextAlign
The horizontal alignment of the drawn text within the rectangle.
verticalAlign
Type: BitMiracle.Docotic.Pdf.PdfVerticalAlign
The vertical alignment of the drawn text within the rectangle.
lineHeight
Type: System.Single
Height of the one line of drawn text (distance between top lines of two consecutive strings).

Return Value

Type: Int32
The number of characters drawn.

Remarks

The text represented by the text parameter may be drawn in multiple lines. This method clips the text so that it does not appear outside the specified rectangle. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the rect parameter. A carriage return-line feed sequence also breaks the line.

Please use DrawString Overload if you want to draw only one line of text.

See Also