PRB: SET PRINTER ON and ??? Cause an Unnecessary Page Eject

ID: Q114186

2.50 2.50a 2.50b WINDOWS kbprg kbprb

The information in this article applies to:

SUMMARY

In FoxPro for Windows, when you combine the SET PRINTER ON command with the ??? command to output data to a printer, a blank page ejects prior to the print job being sent.

CAUSE

When the SET PRINT ON command is issued, a print job is started. When the ??? command is issued, the current print job is closed, and a new raw print job is opened.

In FoxPro for Windows, when a print job is opened and then closed, a blank page will be printed even if no output was sent.

WORKAROUND

In FoxPro for MS-DOS, create a printer driver using the Generic printer settings. You can then use this printer driver in FoxPro for Windows.

To do this:

1. Load FoxPro for MS-DOS. Set your resource (FOXUSER) file to the one that

   you will use for your FoxPro for Windows applications. If this is the
   resource file in your FoxPro for Windows directory and that directory is
   called FOXPROW and is located on drive C, type the following command:

      SET RESOURCE TO c:\foxprow\foxuser

   Doing this ensures that the printer driver is stored in the correct
   resource file.

2. From the File menu, choose Printer Setup.

3. Select the Printer Driver Setup check box, and then choose New.

4. In the Printers list box, scroll down to the Generic Printer driver.

5. In the Setup Name box, type "Generic" (without the quotation marks),

   and then choose OK.

6. In the Printer Driver Setups dialog box, choose either Cancel or Set. It
   does not matter for the purpose of creating the printer driver.

7. In the Printer Setup dialog box, choose OK.

8. Exit FoxPro for MS-DOS. Load FoxPro for Windows. In the Command window,

   type:

     SET PDSETUP TO "Generic"
     SET PRINTER ON
     ??? ''                              && Opens printer in 'raw' mode
     ? "I set the printer in raw mode"
     ??? CHR(27)+"(s3B"
     ? "I am printing bold"
     ??? CHR (27) + "(s0B"
     ? "Now it's not bold"
     SET PRINTER OFF
     SET PRINTER TO

For additional information, please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q99542
   TITLE     : Printing Reports Created w/ Question Marks in
               FP for Win

MORE INFORMATION

Steps to Reproduce Problem

The following code causes a blank page to eject prior to the print job that is sent. It seems that the page eject occurs at the location of the first ??? command (that is, if you remove the first ??? command, the page eject occurs after the first line of text is printed).

   ** The escape codes in this program are for an HP laser printer.
   ** They are for illustration purposes only.

   SET PRINTER ON
   ??? ''                             && Opens printer in 'raw' mode
   ? "I set the printer in raw mode"
   ??? CHR(27)+"(s3B"
   ? "I am printing bold"
   ??? CHR (27) + "(s0B"
   ? "Now it's not bold"
   SET PRINTER OFF
   SET PRINTER TO

Additional reference words: FoxWin 2.50 2.50a 2.50b KBCategory: kbprg kbprb KBSubcategory: FxprintRaw
Keywords          : FxprintRaw 
Version           : 2.50 2.50a 2.50b
Platform          : WINDOWS

Last Reviewed: May 1, 1996