drawTextSizeIn

drawTextSizeIn(str:        String;
               width:      Integer;
               textHeight: Integer output): Integer;

The drawTextSizeIn method of the Printer class returns the size of the text by using the current values of the drawFont properties, setting a bounding rectangle equal to the width parameter, and applying word wrap. An exception is raised if this method is invoked from a server method.

The text alignment and the text rotation properties (that is, drawTextAlign, drawTextCharRotation, and drawTextRotation) are not used in determining this size.

The parameters for the drawTextSizeIn method are listed in the following table.

Parameter Description
str Text string that is to be measured
width Width of the rectangle (in pixels) for word wrap
textHeight Text height returned

The drawTextSizeIn method returns the text width, which you could then use in the drawTextIn method.

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.