RpPrinter:GetTextLength() Method

<< Click to Display Table of Contents >>

Navigation:  RpPrinter & PtrDevice Class Overview > RpPrinter Class >

RpPrinter:GetTextLength() Method

Previous pageReturn to chapter overviewNext page

Purpose

To get the length of a string based on the current font.

Syntax

<oRpPrinter>:GetTextLength(cText) Float

Arguments

cText

The text to measure.

Description

This method returns the length of <cText> based on the current font.  The value is returned in the current unit of measure.  The length returned is not the string length; it is the amount of area the text consumes when it is printed.

Example

// Don't go off the end of the page

if oRpPrinter:GetTextLength("Hello, World!") >; oRpPrinter:PrintAreaWidth

         // try a smaller font

endif