PdfCanvas.DrawText Method (String, PdfRectangle, PdfTextAlign, PdfVerticalAlign)

Docotic.Pdf library help > BitMiracle.Docotic.Pdf > PdfCanvas Class > PdfCanvas Methods > DrawText Method > DrawText Method (String, PdfRectangle, PdfTextAlign, PdfVerticalAlign)
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)


public int DrawText(
	string text,
	PdfRectangle rect,
	PdfTextAlign align,
	PdfVerticalAlign verticalAlign
Public Function DrawText ( 
	text As String,
	rect As PdfRectangle,
	align As PdfTextAlign,
	verticalAlign As PdfVerticalAlign
) As Integer


Type: System.String
The string to draw.
Type: BitMiracle.Docotic.Pdf.PdfRectangle
The PdfRectangle structure that specifies the location of the drawn text.
Type: BitMiracle.Docotic.Pdf.PdfTextAlign
The horizontal alignment of the drawn text within the rectangle.
Type: BitMiracle.Docotic.Pdf.PdfVerticalAlign
The vertical alignment of the drawn text within the rectangle.

Return Value

Type: Int32
The number of characters drawn.


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() if you want to draw only one line of text.

See Also