Printing with UNIX Clients and Servers Using LPR/LPD

A line printer remote (LPR) utility lets an application on one computer print to a spooler on a remote computer. The receiving utility is called a line printer daemon (LPD). The LPR/LPD combination was developed for UNIX computers but is widely used for many operating systems. Both utilities are included in Print Services for Unix.

To install Print Services for Unix

  1. From the Start menu, point to Settings , click Control Panel , double-click Add/Remove Programs , and then click Add/Remove Windows Components .

  2. Click Next .

  3. In Components , click Other Network File and Print Services (but do not select or clear its check box), and then click Details .

  4. Select the Print Services for Unix check box.

  5. Click OK , and then click Next .

Printing Documents Received Through the LPD Utility

The LPD utility, Lpdsvc, receives print jobs from computers that have LPR utilities. Any client that is fully RFC 1179 compliant can use LPR to send printing to Lpdsvc on a printer server that is running Windows 2000. Partially compliant systems might fail.

note-icon

Note

Windows 2000 also has an emulation subsystem in which you can run and print from UNIX applications written to the POSIX.1 standard. The control commands and processing are the same as in native UNIX systems.

Prerequisites

LPR print clients can print to a print server running Windows 2000 by sending straight text and using the f command so that Windows 2000 formats the print jobs properly. The following connections must be in place:

  • Both client and server have TCP/IP, and the client has an RFC-compliant version of LPR.

  • Print Services for Unix is installed on the print server.

  • The printer share name is identified to the LPR software on the client. The share name may differ from the printer name in the Printers folder and in the printer's Properties dialog box.

In Windows 2000, the LPD utility is included in Print Services For Unix. When installed, it starts automatically for all shared printers. LPR clients know the printer names as the Windows 2000 share names.

Directing Output

Use the LPR utility on the client to direct the output to a printer on the print server. For example, on a Windows 2000 client, type the following on the command line:

lpr -S servername -P queuename filename

Other LPR clients might use a different command or syntax.

Default Data Types

Print Services for Unix sets the print data type when it sends the document to the spooler. This is derived from the control command included in a print job from an LPR client. It might be necessary to change the default data type at the client to avoid processing PCL or PostScript print jobs as TEXT when they are actually RAW. For more information about the data types, see "Print Processor" earlier in this chapter.

If the control command is f or p , the data type is TEXT, and the spooler edits the document file to print correctly. If the command is l , the data type is RAW and no editing is done. If the command is o , the document is already formatted in PostScript code and is assigned the RAW data type.

Some UNIX systems usually send the f command by default, resulting in the following symptoms:

  • The output includes PCL or PostScript code.

  • Extended characters are printed incorrectly.

  • The printer's default font is used.

  • An extra page is printed at the end.

You can make a registry entry to force Windows 2000 to process the data as RAW. For more information, see the see the Knowledge Base link on the Web Resources page at http://windows.microsoft.com/windows2000/reskit/webresources . Search for the keyword SimulatePassThrough.

Sending Documents Through the LPR Utility

The LPR Monitor (Lprmon) provided with Print Services for Unix acts as the client for printing according to RFC 1179 guidelines and spools to an LPD-enabled target host. The target is usually a UNIX, MVS, or VAX/VMS-based computer but can also be a network adapter, an external network box, a Windows NT–based computer, or a print server running Print Services for Unix or another version of LPD.

Prerequisites

To use Lprmon, the client must have TCP/IP and Print Services for Unix installed. The target server must be running a Berkeley Style Daemons (BSD)–compatible LPD utility according to RFC 1179. If the server is running Windows 2000 or Windows NT, check that Print Services for Unix is started.

Entering the Printer Address

While installing this monitor, the Add Port Wizard asks you to enter the Name Or Address Of Host Providing LPD and Name Of Printer On The Target LPD . The printer name is defined by the LPD and varies based on the manufacturer. Please refer to the LPD product documentation for the printer names.

Host Name or IP Address

For the host name, enter the DNS name or the IP address. The DNS name of the target computer needs to be defined in the host file on the Windows 2000 print server hosts file. You can use the ping command to verify the name and address of the target computer. If the connector is a network adapter instead of a computer host, see the documentation provided with it.

Printer Name - Host

If the target host is a UNIX computer and you do not know its name, log on to the UNIX computer that is running a BSD-compatible LPD daemon. To view the target's /etc/printcap file, at the command prompt, type:

cat /etc/printcap

Each entry in a UNIX /etc/printcap file corresponds to a UNIX print queue. The first field of an entry lists names for the print queue (for example, LP, Lablaser, or The_Lab_Printer), separated by "|" characters and ending with a colon. For example, a 9600-baud TTY printer might show a listing such as:

lp|lablaser|the_lab_printer:\

:lp=/dev/ttya:br#9600:\

:lf=/usr/spool/lpd/lablaser-err:\

:sd=/usr/spool/lpd/lablaser:

The second line tells what kind of printer is used. You can enter any of the names for the print queue in the Add LPR Port Wizard. Alternatively, to display a list of all defined print queue names on the host, type:

lpc stat all

note-icon

Note

This example is for illustration only. Refer to UNIX documentation for information about the /etc/printcap file.

Printer Name - Network Adapter

Because the printer name varies depending on the manufacturer, see the adapter's documentation for details. Typical examples include TEXT, PASSTHROUGH, RAW, P1, P2, and so on.

Changing the Default Control Command

The LPR sends a processing instruction in each print job in the form of a control command: f , l , o , or p . The default is l for Lprmon and f for Lpr.exe, but it can be changed by modifying a registry entry.

caution-icon

Caution

Do not use a registry editor to edit the registry directly unless you have no alternative. The registry editors bypass the standard safeguards provided by administrative tools. These safeguards prevent you from entering conflicting settings or settings that are likely to degrade performance or damage your system. Editing the registry directly can have serious, unexpected consequences that can prevent the system from starting and require that you reinstall Windows 2000. To configure or customize Windows 2000, use the programs in Control Panel or Microsoft Management Console (MMC) whenever possible.

To change the default command for a particular printer

  1. Start a registry editor (Regedt32.exe or Regedit.exe).

  2. Add the following entry to the registry:
    Entry name: PrintSwitch
    Path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print \Monitors\LPRPort\Ports\<Port-name>\<IP Address or Host name:Printer-name >
    Data type: REG_SZ
    Value: <control command>

Normally, you would set the default value to l , but this can cause a problem when sending an ASCII text file to a PostScript printer on a UNIX computer. The l value sets the RAW data type, and the PostScript instructions are ignored. Many UNIX systems add software that scans arriving documents for PostScript code with the l value. If it is found, the document goes directly to the printer; otherwise, the software adds PostScript code.

Not all scanners recognize the output of the Windows 2000 PostScript driver as valid PostScript code, and the printer prints PostScript code instead of interpreting it. To correct this, set o as the default value for this registry entry.

Respooling

LPR must include an accurate byte count in the control file, but it cannot get it from the local print provider. After Lprmon receives a document from the local print provider, it spools it a second time as a temporary file in the System32 subfolder, finds the size of that file, and sends the size to the LPD print server.

Status Reporting

The LPR protocol does not return a detailed error status report. If there is a problem, the message is always ERROR. To find the specific problem, see Windows 2000 Server Help.