Microsoft KB Archive/33047

= How to Send PostScript Commands to Apple LaserWriter Printer =

Article ID: 33047

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 1.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Interpreter 3.0 for Macintosh

-



This article was previously published under Q33047



SUMMARY
A PostScript Escape font and the DrawText library routine enable you to send PostScript commands to the Apple LaserWriter printer with the WINDOW OUTPUT # statement.

This information applies to Microsoft QuickBASIC Version 1.00, the Microsoft BASIC Compiler Version 1.00, and the Microsoft BASIC Interpreter Version 3.00 for the Apple Macintosh.



MORE INFORMATION
When BASIC sends output to the LPT1: or LPT1:PROMPT device, the currently chosen printer driver processes the output. Unlike the ImageWriter driver, the LaserWriter driver converts Macintosh QuickDraw ROM calls to PostScript commands before printing. PostScript is the command language (written by Adobe, Inc.) that is used to control the output of the Apple LaserWriter printer.

For more information about the PostScript language, there are several excellent books written by Adobe, Inc., published by Addison-Wesley Publishing Company, Inc.

To use literal PostScript commands, you must have a font named &quot;PostScript Escape&quot; available. The &quot;Font/DA Mover&quot; program can be used to copy fonts from one file to another. The PostScript Escape font can be obtained from user groups or Apple, Inc. For more information about the PostScript Escape font, please refer to &quot;MacTutor Magazine,&quot; June 1986.

An alternate approach is to specify one of the current fonts as the PostScript Escape font. To do this, you must use ResEdit and change the &quot;STR ID -8188&quot; of the LaserWriter driver from &quot;PostScript Escape&quot; to the name of the font of your choice. Whenever this font is used for output, the LaserWriter driver passes this text directly to the printer as PostScript commands. Note that text in this font from other programs such as Microsoft Word or Apple MacWrite is also printed as literal PostScript commands.

A separate article describes how to set up the PostScript Escape font in a compiled application (query on the keywords POSTSCRIPT AND ESCAPE).

However, rather than defining a PostScript font, it is easier to embed PostScript commands as a picture comment when sending a picture to the LaserWriter, as shown in another separate article found by querying on the keyword PICCOMMENT.

Code Example
'   This program draws a box around the page using PostScript commands. '   For the BASIC interpreter 3.00 and BASIC compiler 1.00, you must '   add the following statement to access the DrawText routine: ' LIBRARY &quot;TOOLLIB&quot; '   This LIBRARY statement is not needed for QuickBASIC programs. '   The variable PS% must be initialized to the font number of the '   PostScript Escape font: PS%=xxx ' xxx must specify font number of PostScript Escape. OPEN &quot;LPT1:&quot; FOR OUTPUT AS #1 WINDOW OUTPUT #1        ' Redirects window output to printer. PRINT &quot;PostScript will draw a box around this page.&quot; TEXTFONT PS%            ' Set the PostScript Escape Font DrawText &quot;initclip clippath  stroke&quot;    ' PostScript commands CLOSE#1 Note: You cannot use PRINT; you MUST use DrawText or DrawString to send the PostScript commands. PRINT always sends information one character at a time, but PostScript commands must be sent in whole strings. If you attempt to use PRINT, a PostScript error results, and no output appears.

Additional query words: BasicCom MQuickB

Keywords: KB33047

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.