PrintWidth

Description

Determines the width of a string using the current font of the specified print job.

Syntax

PrintWidth ( printjobnumber, string )

Argument

Description

printjobnumber

The number the PrintOpen function assigned to the print job

string

A string whose value is the text for which you want to determine the width


Return value

Integer. Returns the width of string in thousandths of an inch using the current font of printjobnumber if it succeeds and -1 if an error occurs. If any argument's value is null, PrintWidth returns null. If the returned width exceeds the maximum integer limit (+32767), PrintWidth returns -1.

Examples

These statements define a new blank page and then set W to the length of the string PowerBuilder in the current font and then use the length to position the next text line:

long Job
int W
 
// Start a new print job.
Job = PrintOpen()
 
// Determine the width of the text.
W = PrintWidth(Job,"PowerBuilder")
 
// Use the width to get the next print position.
Print(Job, W - 500, "Features List")

See also

PrintClose

PrintOpen