<< Back to man.ChinaUnix.net

8.4 Setting up LPR on Windows clients

The program clients use to print via LPD is the Line Printer Remote, or LPR program. The following instructions cover enabling this program on Windows clients.

8.4.1 Windows 3.1/Windows for Workgroups 3.11

Several commercial TCP/IP stacks are available for Win31, that provide LPR client programs, in addition to the basic TCP/IP protocol to Win31. WfW has TCP/IP networking available for free from Microsoft, but it doesn't include an LPR client. Unfortunately, I have not come across a freeware implementation of a 16-bit Windows LPR client, so with the following instructions I use the Shareware program WLPRSPL available from http://www.winsite.com/info/pc/win3/winsock/wlprs41.zip. This program must be active during client printing, and is usually placed in the Startup group.

Organizations that want to use UNIX as a printserver to a group of Win31 clients without using a commercial or shareware LPR program have another option. The Microsoft Networking client for DOS used underneath Win31 contains SMB-based printing which is covered later in the chapter. DOS networking client setup and use are covered in Chapter 2 and Chapter 7.

If LPR-based client printing is desired and the organization doesn't want to upgrade to Win95, (which has several LPR clients available) the following instructions can be used. WLPRSPL needs a Winsock under Windows 3.1, so for the example I explain the setup of the Novell 16-bit TCP/IP client. The stack can be FTPed from Novell, and is easy to integrate into sites that already use the 16-bit NetWare networking client, usually NW 3.11 and 3.12. In most cases, however, sites that use NetWare + Win31 are probably best off printing through the NetWare server, then loading an LPR spooler as an Netware Loadable Module (NLM) to send the job over to FreeBSD.

As an alternate, the Microsoft Networking DOS 16-bit TCP/IP client under Win31 contains a Winsock, as does Microsoft TCP/IP for WfW. The target machine used here is a Compaq Deskpro 386/33 with 12MB of ram with an operating version of Windows 3.1, and a 3com 3C579 EISA network card. The instructions assume an LPR printserver on the network, named mainprinter.my.domain.com with a print queue named RAW.

Use the installation instructions in Exhibit 8.1 for a quick and dirty TCP/IP Winsock for Win31 systems. Administrators who already have the Novell IPX client installed should skip those steps.

8.4.2 Installation of the Novell TCP/IP Winsock client

  1. Make sure that the machine has enough environment space (2048 bytes or more) by adding the following line to the config.sys file and rebooting:

    SHELL=C:\COMMAND.COM /E:2048 /P
    
  2. Obtain the TCP16.EXE file from ftp://ftp3.novell.com/pub/updates/eol/nweol/tcp16.exe.

  3. Obtain the Network Adapter support diskette for the network card in your machine. This should be supplied with the card, or available via FTP from the network adapter manufacturer's FTP site.

  4. Now you need the file LSL.COM. This is available on some Network Adapter Driver diskettes, it used to be available from the VLM121_2.EXE file from Novell but unfortunately this file is no longer publicly accessible from Novell.

  5. If you have vlm121_2.exe in a temporary directory, run it. This will extract a number of files.

  6. One of the files extracted is LSL.CO_ extract this file with the command nwunpack lsl.co_.

  7. Create the directory c:\nwclient. Then, copy lsl.com from the temporary directory into the directory.

  8. Obtain and install the printer driver for the model of printer that you will be spooling to and point it to LPT1:. Win31 and WfW 3.11 have an incomplete printer driver list, so if you need a driver Microsoft has many Win16 printer drivers on their FTP site. A list is available at ftp://ftp.microsoft.com/Softlib/index.txt. In addition, if you are installing a PostScript printer driver for a printer supplied in Win31, it may be necessary to patch the driver. The Microsoft PostScript driver supplied in Win31 is version 3.5. (The patch named PSCRIP.EXE which brought the PostScript driver to version 3.58 is no longer publicly available.) WfW already uses the more recent PostScript driver, as does Win31 version A. Installing the Adobe PostScript driver for Win31 is also an option. (see http://www.adobe.com/support/downloads/pdrvwin.htm for the version 3.1.2 Win31 PostScript driver).

  9. Look on the network adapter driver disk for the subdirectory nwclient/ and then look for the ODI driver for the adapter card. For example, on the 3com 3C509/3C579 adapter driver disk, the driver and location are \NWCLIENT\3C5X9.COM. Copy this driver to the c:\nwclient directory.

  10. Create a file called NET.CFG in the c:\nwclient directory. Often, the network card adapter driver diskette has a template for this file in the same location as the ODI driver. This can be modified, as can the following example:

    LINK SUPPORT
    
    BUFFERS 4 1600
    
    MEMPOOL 8192
    
    LINK DRIVER
    3C5X9
    
    ; PORT 300 (these are optional, if needed by card uncomment)
    
    ; INT 10 (optional, uncomment and modify if needed)
    
  11. Attempt to load the network card driver. First load lsl, then the ODI driver. With the 3com card the commands are:

    lsl
    3c5x9
    

    If the driver properly loads it will list the hardware port and interrupt settings for the network adapter. If it has loaded properly, unload the drivers in reverse order with the /u command:

    3c5x9 /u
    lsl /u
    
  12. Go to the temporary directory that contains the tcp16.exe file and extract it by running the program.

  13. Run the install batch file by typing installr. It should list New Installation detected. It will then copy a number of files into nwclient, add some commented-out sections to net.cfg, and call edit on net.cfg.

  14. Read the editing instructions and make the appropriate entries. The sample net.cfg file from above would look like this.

    LINK SUPPORT
    
    BUFFERS 4 1600
    
    MEMPOOL 8192
    
    LINK DRIVER 3C5X9
    
    FRAME ETHERNET_II
    
    Protocol TCPIP
    
    PATH TCP_CFG c:\nwclient
    
    ip_address 192.168.1.54 LAN_NET
    
    ip_netmask 255.255.255.0 LAN_NET
    
    ip_router 192.168.1.1 LAN_NET
    
    Bind 3C5X9 #1 Ethernet_II LAN_NET
    

    Save and exit, the Installer should list TCP16 installation completed.

  15. Reload the client with the commands:

    lsl
    3c5x9
    tcpip
    

    The TCP/IP driver should list the IP numbers and other information.

  16. Optionally, create either a HOSTS file, or a RESOLV.CFG file (pointing to a nameserver) in c:\nwclient. Check to see this is operating properly by pinging a hostname.

    Add the c:\nwclient directory to the PATH, as well as the 3 startup commands in step 15 in autoexec.bat

8.4.3 Installation of the LPR client on 16-bit Windows with a Winsock installed

The following assumes a running Win31 installation with a Winsock or a running WfW installation with the 32-bit Microsoft TCP/IP protocol installed.

  1. Install the printer driver desired. See step 8 of the previous set of instructions.

  2. Obtain and extract into a temporary directory the wlprs41.zip file from the location mentioned above.

  3. Run setup.exe from the temporary directory containing the wlprs files.

  4. In setup, accept default directory, and check Yes to add to its own group. Click Continue when asked for group name, and check whatever choice you want when asked to copy the doc files.

  5. Click No when asked to add the program to Startup.

  6. On the UNIX FreeBSD print spooler, make sure that there is an entry in /etc/hosts.lpd or /etc/hosts.equiv for the client workstation, thereby allowing it to submit jobs.

  7. Double-click the Windows LPR Spooler icon in the Windows LPR Spooler group that is opened. When it asks for a valid spool directory, just select the c:\wlprspl directory that the program installed its files into.

  8. When asked for a valid Queue Definition File, just click OK to use the default filename. The program automatically creates a queue definition file.

  9. The program opens up with its menu. Click Setup in the top menu, then select Define New Queue.

  10. For a local spool filename, just use the name of the remote queue (RAW) to which the client prints.

  11. For the remote printer name, use the same name as the remote queue (RAW) to which the client prints.

  12. For the remote hostname, use the machine name of the FreeBSD print spooler. mainprinter.ayedomain.com.

  13. For the Description, enter a description such as 3rd floor Marketing printer.

  14. For the protocol, leave the default of BSD LPR/LPD selected.

  15. Click on the Queue Properties, and make sure that the Print unfiltered is selected. If you're printing PostScript, then also click the Advanced options button. Make sure that Remove trailing Ctrl-D is unchecked, and that Remove Leading Ctrl-D is checked. Also with PostScript, if the printer cannot print ASCII, uncheck the Send header page box. (PostScript header/banner pages are discussed later in this chapter)

  16. Click OK. At the main menu of the program, click File, then Control Panel/Printers to bring up the Printers control panel of Windows.

  17. Make sure that the Use Print Manager button is checked, then highlight the printer driver and click the Connect button.

  18. Scroll down to the C:\WLPRSPL\RAW entry for the spool that was built and highlight this. Click OK.

  19. Minimize the Windows LPR Spooler. Copy the Windows LPR Spooler icon to the Startup group. Click File/Properties with the Windows LPR Spooler icon highlighted in the Startup group. Check the Run Minimized button.

  20. Exit Windows, and when the Save queue changes? button comes up, click Yes.

  21. Restart windows and make sure that the spooler starts up.

  22. Open the Control Panel and look for a new yellow icon named Set Username If you are running the Novell or other Winsock under Win31, click on this icon and put the username of the person using this computer into the space provided. If you are running WfW, this isn't necessary because Windows will supply the username.

  23. If the spooler is not started properly in some installations, there may be a bug. If placing the icon in the Startup group doesn't actually start the spooler, the program name can be placed in the run= line of win.ini.

  24. Try printing a print job from an application such as Notepad. If everything goes properly, clicking on the Queues/Show remote printer status" in the Windows LPR menu should show the print job spooled and printing on the remote printserver.

8.4.4 Installation of LPR client on Windows 95/98

The wlprspl program also can be used under Windows 95, but as a 16-bit program, it is far from an optimal implementation on a 32-bit operating system. In addition, Win95 and its derivatives fundamentally changed from Windows 3.1 in the printing subsystem. For these reasons I use a different LPR client program for Win95/98 LPR printing instructions. It is a full 32-bit print program, and it installs as a Windows 32-bit printer port monitor. The program is called ACITS LPR Remote Printing for Windows 95 and it is located at http://shadowland.cc.utexas.edu/acitslpr.htm.

ACITS stands for Academic Computing and Instructional Technologies Services. The ACITS LPR client includes software developed by the University of Texas at Austin and its contributors, it was written by Glenn K. Smith, a systems analyst with the Networking Services group at the university. The filename of the archive in the original program was ACITSLPR95.EXE and as of version 1.4 it was free for individuals or organizations to use for their internal printing needs. Since that time, it has gotten so popular that the university has taken over the program, incremented the version number (to get out from under the free license) and is now charging a $35 per copy fee for commercial use for the newer versions. The older free version can still be found on overseas FTP servers, such as http://www.go.dlr.de/fresh/pc/src/winsock/acitslpr95.exe.

It is likely that the cost of a shareware/commercial LPR program for Win95 plus the cost of Win95 itself will meet or exceed that of Win2K. As such, users wishing to print via LPR to FreeBSD UNIX systems will probably find it cheaper to simply upgrade to Windows NT Workstation or Win2K.

ACITS LPR and Win95 have a few printing idosyncracies. Most Win95 programs, such as Microsoft Word, expect print output to be spooled on the local hard drive and then metered out to a printer that is plugged into the parallel port. Network printing, on the other hand, assumes that print output will go directly from the application to the remote print server. Under Win95, local ports have a setting under Properties, Details, Spool Settings labeled "Print directly to the printer". If this is checked, the application running on the desktop (such as Microsoft Word) will not create a little Printer icon with pages coming out of it or use other means of showing the progress of the job as it is built. This can be very disconcerting to the user of a network printer, so this option should be checked only with printers plugged directly into the parallel port. Worse, if this is checked with ACITS, it can cause the job to abort if the remote print spooler momentarily goes offline.

Another local setting also should be changed. Generally, with local ports, Win95 builds the first page in the spooler and then starts printing it while the rest of the pages spool. If ACITS starts printing the first page while the rest of the pages are building, timeouts at the network layer can sometimes cause very large jobs to abort. The entire job should be set to completely spool before the LPR client passes it to the UNIX spooler. The problem is partly the result of program design: because ACITS is implemented as a local printer port instead of being embedded into Win95 networking (and available in Network Neighborhood) the program acts like a local printer port in some ways.

The LPR program can be set to deselect banner/burst page printing if a PostScript printer that cannot support ASCII is used. The burst pages referred to here are NOT generated by the Windows machine. Use the instructions in Exhibit 8.3 to install ACITS.

LPR client on Win95/98 installation instructions

  1. Obtain the ACITSLPR95.EXE file and place it in a temporary directory such as c:\temp1.

  2. Close all running programs on the desktop. The computer must be rebooted at completion of installation or the program will not work.

  3. Click Start, Run and type in c:\temp1\acitslpr95 then click Yes at the InstallShield prompt.

  4. Click Next, then Yes. The program will run through some installation and then presents a Help screen that explains how to configure an LPR port.

  5. After the help screen closes, the program asks to reboot the system. Ensure that Yes is checked and click Finish to reboot.

  6. After the machine comes back up, install a Printer icon in the Start, Settings, Printers folder if one hasn't been created for the correct model of destination printer.

  7. With the Printers folder open, right-click over the printer icon that needs to use the LPR program and click on the Properties tab.

  8. Under the Details tab, click the Add Port tab, then click Other.

  9. Highlight the ACITS LPR Remote Printing line and click OK.

  10. The Add ACITS LPR screen opens. Type in the hostname of the UNIX system that the client spools through-- mainprinter.ayedomain.com.

  11. Type in the Printer/Queue name and click OK. (Some versions have a "Verify Printer Information" button.) The LPR program then contacts the UNIX host and makes sure that the selected printer is available.

    Note: If this fails the client machine name is probably not in the /etc/hosts.equiv or etc/hosts.lpd on the FreeBSD printserver. Most sites may simply decide to put a wildcard in hosts.equiv to allow printing, especially if DHCP is used, but many security-conscious sites may stick with individual entries in hosts.lpd.

  12. If the printer is PostScript and cannot print ASCII, make sure that the "No banner page control flag" is checked to turn off banner pages. Accessible under Port settings, this flag is overridden if the /etc/printcap file specifies no banner pages.

  13. Review how the "send plain text control flag" is set. With this flag unchecked, the LPR code sent is L, (i.e., print unfiltered) meaning that the if filter gets called with the -c option. This is equivalent to the local invocation of /usr/bin/lpr -l. With the flag checked, the code is F, (formatted) meaning that the if filter gets called without the -c option. This is equivalent to the default invocation /usr/bin/lpr. (This is also an issue under Windows NT, which retypes the print job to text if this flag is checked. Some filters understand the -c flag, which is used to preserve control characters, so it should generally remain unchecked.

  14. Leave the "Send data file before control file" box unchecked. This option is used only in rare mainframe spooling circumstances.

  15. Click OK, then click the Spool Settings button at the properties page.

  16. Make sure that the "Spool print jobs so program finishes printing faster" box is checked.

  17. Make sure that "Start printing after last page is spooled" box is checked.

  18. Make sure that "Disable bi-directional support for this printer" is checked, or greyed out.

  19. Make sure that the "Spool data format" is set to RAW. Some printer drivers present a choice of EMF or RAW, such as the Generic Text driver, in this case select RAW.

  20. Click OK, then OK again to close the Printer Properties. The printer icon now spools through FreeBSD.

8.4.5 Installation of LPR client on Windows NT

Unlike WfW and Win95 TCP/IP, Windows NT--both server and workstation--includes an LPR client as well as an LPD program that allows incoming print jobs to be printed from LPR clients, such as UNIX systems.

To install the LPR client and daemon program under Windows NT 3.51, use the following instructions. The TCP/IP protocol should be installed beforehand and you must be logged in to the NT system as Administrator. This can be done at any time after the NT system is installed, or during OS installation:

  1. Double-click on Main, Control Panel, then Network Settings.

  2. In the Installed Network Software window, "Microsoft TCP/IP Printing" should be listed as well as "TCP/IP Protocol". If it is, stop here; otherwise continue.

  3. Click the Add Software button to get the Add Network Software dialog box

  4. Click the down arrow and select TCP/IP Protocol and related components. Click Continue.

  5. Check the "TCP/IP Network Printing Support" box and click Continue. LPR printing is now installed. Follow the instructions to reboot to save changes.

To install the LPR client and daemon program under Windows NT 4, use the following instructions. The TCP/IP protocol should be installed beforehand and you must be logged in to the NT system as Administrator. This can be done at any time after the NT system is installed, or during OS installation:

  1. Click on Start, Settings, Control Panel, and double-click on Network to open it up.

  2. Click on the Services tab. Microsoft TCP/IP Printing should be listed. If not, continue steps 3 - 4.

  3. Click Add, then select Microsoft TCP/IP Printing and click OK.

  4. Click Close. Follow instructions to reboot to save changes.

    Note: Any NT Service Packs that were previously installed must be reapplied after these operations.

Once LPR printing has been installed, the Printer icon or icons must be created on the NT system so that applications can print. Since this printer driver does all job formatting before passing the printing to the FreeBSD printserver, the print queues specified should be raw queues on the FreeBSD system, which don't do any job formatting.

To install the printer icon in Print Manager and set it to send print jobs to the FreeBSD UNIX system, use the following instructions under NT 3.51. You must be logged in to the NT system as Administrator. This can be done at any time after the NT system is installed, or during OS installation.

  1. Click on Main, and open it. Then click on Print Manager to open it.

  2. Click on Printer, Create Printer. Select the appropriate printer driver.

  3. Click the down arrow under Print To and select Other.

  4. In the Available Print Monitors window select LPR port and click OK.

  5. Enter the hostname of the FreeBSD printserver, and the name of the printer queue and click OK

  6. Click OK to close the Create Printer window. The Printer icon is created.

To install the printer icon in Print Manager and set it to send print jobs to the FreeBSD UNIX system, use the following instructions under NT 4. You must be logged in to the NT system as Administrator. This can be done at any time after the NT system is installed, or during OS installation:

  1. Click Start, Settings, Printers to open the printer folder.

  2. Double-click Add Printer to start the wizard.

  3. Select the My Computer radio button, not the Network Print Server button and click Next. (The printer is a networked printer, it is managed on the local NT system. Microsoft used confusing terminology here.

  4. Click Add Port and select LPR Port, then click New Port.

  5. Enter the hostname and print queue for the FreeBSD printserver and click OK.

  6. Click Next and select the correct printer driver. Continue until the printer is set up.

The LPR client in Windows NT allows DOS print jobs originating in DOS boxes to be routed to the central UNIX print spooler. This is an advantage over the Win95 and WfW LPR programs.

8.4.5.1 Windows NT Registry Changes

Using the LPR daemon program under Windows NT presents one problem. If the NT server is used as an LPR/LPD "relay", for example, to pass jobs from clients to LPR print queues on a UNIX system, to pass jobs from LPR programs on UNIX terminating at NT print queues, or to pass jobs from Appletalk clients to LPR printers, NT retypes the job if the type code is set to P (text). This can wreak havoc on PostScript files printed through HP LaserJet printers with internal MIO cards in them, if the job originates from the /usr/bin/lpr program under UNIX, which assigns a P type code. The printserver card treats PostScript jobs as text, and instead of the print job, the raw PostScript codes print. This problem often manifests in the following way: /usr/bin/lpr is used to print a PostScript file from UNIX directly to the remote printer printserver, which works fine, but spooling it through NT causes problems.

A registry change that can override the NT Server formatting behavior is detailed in Microsoft Knowledge Base article ID Q150930. With Windows NT 3.51, and 4.0 up to service pack 1 the change is global. Starting with NT 4.0 Service pack 2 the change can be applied to specific print queues, (see Knowledge Base article ID Q168457). This registry change also works for Windows 2000.

Under Windows NT 4.0, the change is:

  1. Run Registry Editor (REGEDT32.EXE)

  2. From the HKEY_LOCAL_MACHINE subtree, go to the following key:

    \SYSTEM\CurrentControlSet\Services\LPDSVC\Parameters

  3. On the Edit menu, click Add Value.

  4. Add the following:

    Value Name: SimulatePassThrough
    Data Type: REG_DWORD
    Data 1

    Note: The default value is 0, which informs LPD to assign datatypes according to the control commands.

Under Windows NT 3.51, the change is:

  1. Run Registry Editor (REGEDT32.EXE)

  2. From the HKEY_LOCAL_MACHINE subtree, go to the following key:

    \SYSTEM\CurrentControlSet\Services\LPDSVC\Parameters

  3. On the Edit menu, click Add Value.

  4. Add the following:

    Value Name: SimulatePassThrough
    Data Type: REG_DWORD
    Data 1

    Note: The default value is 0, which informs LPD to assign datatypes according to the control commands.

  5. Create an LPD key at the same level as the LPDSVC key.

  6. Click the LPDSVC Key, click Save Key from the Registry menu, and then save the file as LPDSVC.KEY

  7. Click the LPD key created in step 5.

  8. Click Restore on the Registry menu, click the file created in step 6, and then click OK.

  9. A warning message appears. Click OK and then quit the Registry Editor.

  10. At a command prompt window, type:

    net stop lpdsvc
    net start lpdsvc
    

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.