Redirecting Fonts and Graphics to Printer with WINDOW OUTPUT# (20521)



The information in this article applies to:

  • Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0
  • Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0a
  • Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0b
  • Microsoft BASIC Compiler
  • Microsoft BASIC Interpreter for Apple Macintosh 2.0
  • Microsoft BASIC Interpreter for Apple Macintosh 2.1
  • Microsoft BASIC Interpreter for Apple Macintosh 3.0

This article was previously published under Q20521

SUMMARY

You can redirect the sending of fonts or graphics from the current output window to the Macintosh printer.

You can first OPEN "LPT1:PROMPT" or "LPT1:" as device #n, and then use WINDOW OUTPUT #n to redirect output to the printer device, as shown in the example below.

To change text font or face, you must execute the CALL TEXTFONT or CALL TEXTFACE statement AFTER the WINDOW OUTPUT #n statement. Then a subsequent PRINT statement will use the specified font or face to the printer. (The font or face won't change on the printer if CALL TEXTFONT or CALL TEXTFACE is before the WINDOW OUTPUT #n statement.) When sending output with WINDOW OUTPUT #n, use the PRINT statement instead of PRINT#n.

MORE INFORMATION

For a description of which BASIC versions support the Apple ImageWriter I, II, or LQ, or the Apple LaserWriter, please query on the following words for a separate article in this database:

LQ and ImageWriter and Macintosh and Support and LaserWriter

The following is a code example:
OPEN "LPT1:" FOR OUTPUT AS #1         ' Opens printer as #1.
WINDOW OUTPUT #1            ' Redirects output to device #1.
REM  Perform any window output here (TEXTFONT, TEXTSIZE, PRINT,
REM  CIRCLE, PICTURE, ROM Routines, etc.) to redirect to the printer.
REM  Exceptions:  The BACKPAT ROM routine (and PUT in BASIC Interpreter
REM  2.00) is not redirected to the printer.
REM  The image must lie within coordinates (1,1)-(638,750)
REM  on the Standard ImageWriter printer.
TEXTFONT 4 : TEXTSIZE 9    ' Changes to Monaco font, size 9.
LOCATE 3,1
PRINT "This is in monaco font."
LINE (1,20)-(55,34),,b  ' Draws box.
CLOSE #1     ' The output won't print until you CLOSE #1.
				
Using this technique, you can send to the printer a much larger area than you can see on the screen. The maximum window that you can see on the standard Macintosh screen must lie within screen coordinates (1,21)-(510,338). By using the above program, you can print to window coordinates (1,1)-(638,750) on the ImageWriter (or LaserWriter) printer, corresponding to a full 8.5-inch x 11-inch printed page. An even larger area can be printed to the wide (15-inch) ImageWriter printer.

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB20521