Products
Purchase
Support
Download
About
Contact
Printing

Project: Many host-based applications support print operations to PC-attached printers via printer emulation or print transparent mode. The Script Language supplements this with the ability to write custom print jobs using data from a host application, several host applications, PC-based files, or some combination of these. For this example, we’ll implement a print test page which demonstrates the print formatting abilities.

Algorithm: The PRINT OPEN command is used to initiate a print task, and the PRINT CLOSE command finishes the job and sends it to the printer. The PRINT FONT and PRINT STYLE commands can be used to set the print characteristics, or the printer defaults can be used. The PRINT STRING, PRINT FILE and PRINT TERMINAL commands determine the data to be sent to the printer. Optionally, the PRINT NEWLINE, PRINT NEWPAGE, and PRINT TABS commands can be used to space the print data appropriately.

Relevant Commands and Functions:

PRINT OPEN — Opens a print channel to specified printer port
PRINT CLOSE — Closes print channel, terminates any active print jobs
PRINT FONT — Changes the active print font and size
PRINT STYLE — Changes active print character attributes
PRINT STRING — Prints the specified string
PRINT NEWLINE — Sends a carriage return and line feed to printer
PRINT NEWPAGE — Sends a form feed to the printer

See Also:

PRINT TERMINAL — Sends incoming session activity to printer
PRINT FILE — Prints a file
SELECTION PRINT — Prints the selected text
PRINT CANCEL — Terminates any active print jobs
PRTMETRICS( ) — Returns the current print parameters set as Windows default
PRINT TABS — Specifies print tab width

A Brief Example

PRINT OPEN
PRINT FONT "Arial" 14
PRINT STYLE BOLD
PRINT STRING "PRINT TEST"
PRINT NEWLINE
PRINT NEWLINE
PRINT FONT "Courier New" 12
PRINT STYLE BOLD
PRINT STRING "Courier New, Bold, 12 point: 0123456789"
PRINT NEWLINE
PRINT STYLE NORMAL
PRINT CLOSE

This example uses the PRINT FONT and PRINT STYLE commands to specify the size print characteristics, and the PRINT STRING command to specify the data to be printed. The PRINT STYLE NORMAL command is used to deselect bold printing. The print characteristics specified in the script are applicable only to script-initiated printing and not user-selected printing.

Further Development:
Additional Examples:

The ADDRBOOK example allows the user to enter and organize contact info which is stored in a file, and print it out if desired.