drawTextIn

drawTextIn(text:  String;
           x1:    Real;
           y1:    Real;
           x2:    Real;
           y2:    Real;
           color: Integer);

The drawTextIn method of the Printer class draws a text string on the printer page within a bounded rectangle, 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 drawTextIn method parameters are listed in the following table.

Parameter Description
text Text string that is to be drawn
x1, y1 Left and top points of the bounding rectangle
x2, y2 Right and bottom points of the bounding rectangle
color Color of the text

The text is drawn into the bounding rectangle with word wrap.

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

Window Class Constant Value Description
DrawTextAlign_Center 2 Center-aligned (centered)
DrawTextAlign_Left 0 Left-aligned
DrawTextAlign_Right 1 Right-aligned

Any embedded carriage return character within the text forces a new line for the remaining text.

The text always starts at the vertical point specified by the y1 parameter. 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.

This method is not normally suitable with non-zero values of the drawTextCharRotation and drawTextRotation properties, as the rotation may cause some of the text to be outside the requested rectangle and therefore it may not be totally visible.

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.