Simple Printing

From BR Wiki
Jump to navigation Jump to search

In BR, printing to a printer has traditionally been controlled by the statement OPEN #255. This short sample program will demonstrate how to print:

00010 OPEN #255: "name=PREVIEW:/DEFAULT,recl=32000", DISPLAY,OUTPUT
00020 PRINT #255: "HELLO WORLD!"
00030 CLOSE #255: 

In the above example, PREVIEW will print to a preview window before sending it to the default printer. DEFAULT could be substituted with the name of a printer or SELECT to allow the user to choose which printer. Recl refers to record length and should be high, so that the printer does not perform an untimely carriage return.

To format printing, PRINTER.SYS provides shortcuts to refer to the different styles and fonts available when printing. For example:

00020 PRINT #255: "[BLUE]HELLO WORLD!" 
00020 PRINT #255: "[TAHOMA]HELLO WORLD!"

will print in blue, when Printer.sys is in the file and BRConfig.sys has the line "Include Printer.sys"

To print data from a file, simply add the variable names to the PRINT statement (after OPENing and READing the file of course), for example:

00030 PRINT #255: "NAME$" 

An empty PRINT statement will skip lines, for example:

00500 PRINT #255: "Dear NAME$"
00510 PRINT #255: