Partager via


SET PRINTER Command

Enables or disables output to the printer, or routes output to a file, port, or network printer.

SET PRINTER ON [PROMPT] | OFF

-or-

SET PRINTER FONT cFontName [, nFontSize]
   [STYLE cFontStyle]-or-SET PRINTER TO [FileName [ADDITIVE] | PortName]

-or-

SET PRINTER TO [DEFAULT | NAME WindowsPrinterName]

-or-

SET PRINTER TO NAME \\ServerName\PrinterName

Parameters

  • ON [PROMPT]
    Enables output to the printer. Output formatted with @ ... SAY isn't routed to the printer when SET PRINTER is set to ON. Use SET DEVICE TO PRINTER to direct output from @ ... SAY to the printer.

    You can include PROMPT to display a dialog box before printing starts. In this dialog box you can adjust printer settings. The currently installed printer driver determines which printer settings you can adjust.

  • OFF
    (Default) Disables output to the printer.

  • FONT cFontName [, cFontSize]
    Specifies a default font for printer output. cFontName specifies the name of the font, and cFontSize specifies the point size. For example, the following command specifies 16-point Courier font as the default printer font:

    SET PRINTER FONT 'Courier', 16 
    

    If the font you specify is not available, a font with similar font characteristics is substituted.

  • STYLE cFontStyle
    Specifies a default font style for printer output. If you omit the STYLE clause, the normal font style is used.

    If the font style you specify is not available, a font style with similar characteristics is substituted.

    The font styles you can specify with cFontStyle are as follows:

    Character Font style
    B Bold
    I Italic
    N Normal
    O Outline
    Q Opaque
    S Shadow
    Strikeout
    T Transparent
    U Underline

    You can include more than one character to specify a combination of font styles. For example, the following command specifies 16-point Courier Bold Italic:

    SET PRINTER FONT 'Courier', 16 STYLE 'BI'
    
  • TO [FileName [ADDITIVE] | PortName]
    Specifies a file or port to which output is directed.

    In Visual FoxPro, use SET PRINTER TO NAME instead to specify a printer.

    FileName specifies a file name to which output is directed. If you include ADDITIVE, output is appended to the existing contents of the file. If you omit ADDITIVE, the existing contents of the file are overwritten.

    PortName sends output to a different local printer.

  • TO [DEFAULT | NAME WindowsPrinterName]
    Sends printer output to the default Windows printer or to a specific Windows printer. Windows printer names are stored in Win.ini.

    You can use GETPRINTER( ) or APRINTERS( ) to determine the names of the currently installed printers. For example, the following command displays the Windows Print Setup dialog box and makes printer you select the printer to which printed output is directed:

    SET PRINTER TO NAME GETPRINTER( )
    
  • TO NAME \\ServerName\PrinterName
    Supported only under Windows NT 4.0 or later. Spools printer output to a network printer.

    ServerName is the network name assigned to your print server. This name is assigned by the network administrator and must be unique.

    PrinterName is a name assigned to the printer and is also assigned by the network administrator.

Remarks

Use SET PRINTER TO with the specified arguments to direct output to a file, a port for a different local printer, or a network printer.

Use SET PRINTER TO without an argument to reset output to the default MS-DOS PRN print utility.

When you direct output to a network printer, output prints or collects in a print spooler until a new SET PRINTER command is issued. For additional information about printing on your network, consult your network documentation.

Note   This command does not function in Unattended Server Mode.

See Also

APRINTERS( ) | GETPRINTER( ) | PRINTSTATUS( ) | SET DEVICE