XPRINT SCALE statement

Purpose

Define a custom world coordinate system for a host printer page.

Syntax

XPRINT SCALE (x1!, y1!)-(x2!, y2!)
XPRINT SCALE PIXELS

Remarks

XPRINT SCALE lets you define your own world coordinate system for all subsequent XPRINT statements.  World coordinates may be floating-point values, with the only requirement that x1! not equal x2!, and y1! not equal y2!.  If either pair are equal, an error 5 is generated. The custom coordinates remain with the printer page until XPRINT SCALE is repeated, or the host printer is detached.  If executed without a host printer attached, error 57 is generated.

If x2! is greater than x1!, coordinates grow larger as they move to the right.  Otherwise, they grow larger as they move to the left.

If y2! is greater than y1!, coordinates grow larger as they move downward. Otherwise, they grow larger as they move upward.

By default, the position x2!/y2! translates to the first pixel which is outside of the client area, and therefore not drawn.  However, if OVERLAP MODE is enabled by XPRINT SET OVERLAP, x2!/y2! translates to the final pixel in the client area and is drawn.

XPRINT SCALE PIXELS sets or resets the coordinate system to pixel coordinates.

See also

XPRINT ATTACH, XPRINT GET SCALE, XPRINT SET OVERLAP statement

Example

' Attach the default Windows printer

XPRINT ATTACH DEFAULT

 

' Retrieve the client size (printable area) of the printer page

XPRINT GET CLIENT TO ncWidth!, ncHeight!

 

' Retrieve the resolution (points per inch) of the attached printer

XPRINT GET PPI TO x&, y&

 

' Width in inches of the printable area

ncWidth!  = ncWidth!/x&

 

' Height in inches of the printable area

ncHeight! = ncHeight!/y&

 

' Set the scale to inches, for American letter-size paper

' in portrait mode. This is the equivalent to 8.5x11 minus the margins.

XPRINT SCALE (0,0)-(ncWidth!,ncHeight!)