drawTextAt

drawTextAt(text:  String;
           x1:    Integer;
           y1:    Integer;
           color: Integer);

The drawTextAt method of the Printer class draws a text string on the printer page, using the current values of the drawFont, drawTextRotation, drawTextCharRotation, and drawTextAlign properties. An exception is raised if this method is invoked from a server method.

The drawTextAt method parameters are listed in the following table.

Parameter Description
text Text string that is to be drawn
x1, y1 Horizontal and vertical positions for the text
color Color of the text

The way in which the text is drawn is determined by the value of the drawTextAlign property, as listed in the following table.

Printer Class Constant Value Description
DrawTextAlign_Center 2 Center-aligned (centered) around x1
DrawTextAlign_Left 0 Left-aligned from x1
DrawTextAlign_Right 1 Right-aligned at x1

The text is drawn in a single line, unless it has embedded carriage return characters within it. Each embedded carriage return character forces a new line for the remaining text. All of the position values are relative to the left and top margins, and need not lie within the page.

This method causes the header frame to be printed if the method is called at the start of a new page. The method has no subsequent affect on the current print position.

For details about placing output directly on a printer page at any location without the use of frames and drawing rotated text and characters, see "Free-Format Printing", later in this chapter.