共用方式為


2.2.4.14 Printer Names

A Printer Name is a string that contains the name of a facility for output. It MUST uniquely identify a destination that is local or on a print server. The string MUST NOT be empty.

In RpcOpenPrinter and RpcOpenPrinterEx parameters (sections 3.1.4.2.2 and 3.1.4.2.14), all instances of printer names MUST follow either the PRINTER_NAME or PRINTER_NAME_EX pattern. In any other context, printer names MUST follow the PRINTER_NAME pattern.

The PRINTER_NAME pattern is defined as follows

 UNICODE_NOCOMMA_NOBACKSLASH = <Any UTF-16LE character except "," 
     and "\">
  
 UNICODE_NOBACKSLASH = <Any UTF-16LE character, except "\">
  
 PRINTER_NAME = (SERVER_NAME LOCAL_PRINTER_NAME) |
     (WEB_PRINT_SERVER "/" "printers" "/" LOCAL_PRINTER_NAME "/" 
     ".printer")
  
 WEB_PRINT_SERVER = "http: " "//" host [":" port]
  
 LOCAL_PRINTER_NAME = 1#UNICODE_NOCOMMA_NOBACKSLASH

where:

  • SERVER_NAME is defined in section 2.2.4.16.

  • WEB_PRINT_SERVER specifies the address of the web print server.

  • LOCAL_PRINTER_NAME is a string specifying the local printer name or share name of the printer. Printer names MUST NOT contain the characters ',' and '\'.

Basic notational conventions are specified in [RFC2616] section 2, and the terms host and port are defined in [RFC3986] section 3.2.2.

The PRINTER_NAME_EX pattern extends the PRINTER_NAME pattern and is defined as follows:

 PRINTER_NAME_EX = PRINTER_NAME_EX1 | PRINTER_NAME_EX2 |
     PRINTER_NAME_EX3 | PRINTER_NAME_EX4 | PRINTER_NAME_EX5
  
 PRINTER_NAME_EX1 = SERVER_NAME LOCAL_PRINTER_NAME "," #" "
     "Job " #" " JOB_IDENTIFIER 
  
 JOB_IDENTIFIER = MUST be between 1 and 2,147,483,648, inclusive.
  
 PRINTER_NAME_EX2 = SERVER_NAME LOCAL_PORT_NAME "," #" " "Port"
  
 PORT_NAME = 1#UNICODE_NOCOMMA
  
 PRINTER_NAME_EX3 = SERVER_NAME_NE "\," #" " "XcvPort "
     PORT_NAME
  
 PORT_NAME = 1#UNICODE_NOCOMMA
  
 PRINTER_NAME_EX4 = SERVER_NAME_NE "\," #" " "XcvMonitor "
     PORT_MONITOR_NAME
  
 PORT_MONITOR_NAME = 1#UNICODE_NOBACKSLASH
  
 PRINTER_NAME_EX5 = SERVER_NAME_NE

where:

  • SERVER_NAME_NE is defined in section 2.2.4.16

  • PRINTER_NAME_EX1 specifies the print job identified by JOB_IDENTIFIER on the printer specified with PrinterName.

    When the PRINTER_NAME_EX1 form is used as the name parameter with RpcOpenPrinter or RpcOpenPrinterEx, a job object is returned that can be used with RpcReadPrinter and RpcWritePrinter (sections 3.1.4.9.6 and 3.1.4.9.3) to read and write job content.

  • JOB_IDENTIFIER specifies a server-wide unique decimal identifier for the print job.

  • PRINTER_NAME_EX2 specifies the name of the port to be opened.

    When the PRINTER_NAME_EX2 form is used as the name parameter with RpcOpenPrinter or RpcOpenPrinterEx, a port object is returned that can be used with RpcStartDocPrinter (section 3.1.4.9.1) and RpcWritePrinter to print directly to a port without intermediate spooling.

  • PORT_NAME is a port name (section 2.2.4.10).

  • PRINTER_NAME_EX3 specifies the name of the port to be opened.

    When the PRINTER_NAME_EX3 form is used as the name parameter with RpcOpenPrinter or RpcOpenPrinterEx, a port object is returned that can be used with RpcXcvData (section 3.1.4.6.5) to communicate directly with a port.

  • PRINTER_NAME_EX4 specifies the name of the port monitor to be opened.

    When this form is used as the name parameter with RpcOpenPrinter or RpcOpenPrinterEx, a port monitor object is returned that can be used with RpcXcvData to communicate directly with a port monitor.

  • PORT_MONITOR_NAME is a monitor name (section 2.2.4.8).

  • PRINTER_NAME_EX5 specifies the print server to be opened.

The PRINTER_NAME_WITH_POSTFIX pattern extends the PRINTER_NAME and PRINTER_NAME_EX patterns and is defined as follows:

 PRINTER_NAME_WITH_POSTFIX = PRINTER_NAME_PREFIX "," PRINTER_NAME_POSTFIX

where:

  • PRINTER_NAME_PREFIX is the PRINTER_NAME or PRINTER_NAME_EX pattern.

  • PRINTER_NAME_POSTFIX is an implementation-defined string.

An implementation can use just the PRINTER_NAME and PRINTER_NAME_EX patterns instead of the PRINTER_NAME_WITH_POSTFIX pattern.<223>

An implementation MAY restrict the length of printer name strings.<224>