- PC Printing History
- Printer Communication Protocols and Hardware
- Network Printing Basics
- Setting Up Line Printer Remote on Windows Clients
- Printing PostScript and DOS Command Files
- Checking PostScript Printer Capabilities
- Setting Up LPR/LPD on FreeBSD
- Printer Accounting
- Microsoft Networking Client Printing with Samba
- Printing Between NT Server or NetWare and FreeBSD
- Printing from UNIX
- Managing the UNIX Print Queue
Setting Up Line Printer Remote 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.
Windows 3.1 and 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 this 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), 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 plus Win31 are probably best off printing through the NetWare server and then loading an LPR spooler as a 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.ayedomain.com, with a print queue named raw (see Exhibits 8.1 and 8.2).
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.
Exhibit 8.1 Installing the Novell TCP/IP Winsock client
Make sure that the machine has enough environment space (2,048 bytes or more) by adding the following line to the config.sys file and rebooting.
SHELL=C:\COMMAND.COM /E:2048 /P
Obtain the TCP16.EXE file from ftp3.novell.com/pub/updates/eol/nweol/.
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.
Now you need the file LSL.COM, which 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.
If you have vlm121_2.exe in a temporary directory, run it. This will extract a number of files.
One of the files extracted is LSL.CO_. Extract this file with the command nwunpack lsl.co_.
Create the directory c:\nwclient. Then, copy lsl.com from the temporary directory into the directory.
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).
Look on the network adapter driver disk for the subdirectory nwclient, and then look for the ODI driver with 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.
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 template 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)
Attempt to load the network card driver. First, load lsl, and then load the ODI driver. With the 3Com card the commands are
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
Go to the temporary directory that contains the tcp16.exe file and extract it by running the program.
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.
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."
Reload the client with the following commands.
lsl 3c5x9 tcpip
The TCP/IP driver should list the IP numbers and other information.
Optionally, either create a HOSTS file, or a RESOLV.CFG file (pointing to a nameserver), in c:\nwclient. Check to see that this is operating properly by pinging a hostname.
Add the c:\nwclient directory to the path, as well as the three startup commands in step 15 in autoexec.bat.
Exhibit 8.2 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.
Install the printer driver desired. See step 8 of Exhibit 8.1.
Obtain and extract into a temporary directory the wlprs41.zip file from the location mentioned above.
Run setup.exe from the temporary directory containing the wlprs files.
In setup, accept the 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.
Click No when asked to add the program to Startup.
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.
Double-click the Windows LPR Spooler icon in the Windows LPR Spooler group that is opened. When it asks for a valid spool directory, select the c:\wlprspl directory that the program installed its files into.
When asked for a valid Queue Definition File, click OK to use the default filename. The program automatically creates a queue definition file.
The program opens up with its menu. Click Setup in the top menu, and then select "Define New Queue."
For a local spool filename, just use the name of the remote queue (RAW) to which the client will print.
For the remote printer name, use the same name as the remote queue (RAW) to which the client prints.
For the remote hostname, use the machine name of the FreeBSD print spooler, mainprinter.ayedomain.com.
For the Description, enter a description such as "3rd floor Marketing printer."
For the protocol, leave the default of BSD LPR/LPD selected.
Click on Queue Properties, and make sure that "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 and banner pages are discussed later in this chapter.)
Click OK. At the main menu of the program, click File and then "Control Panel/Printers" to bring up the Printers control panel of Windows.
Make sure that the "Use Print Manager" button is checked, and then highlight the printer driver and click the Connect button.
Scroll down to the C:\WLPRSPL\RAW entry for the spool that was built and highlight this. Click OK.
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.
Exit Windows, and when the "Save queue changes?" button comes up, click Yes.
Restart Windows, and make sure that the spooler starts up.
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.
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.
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.
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 have 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/acits_lpr.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 charges 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 or 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 idiosyncrasies. 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 printserver. 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, does not create a little Printer icon with pages coming out of it or use some 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 spool completely before the LPR client passes it to the UNIX spooler. This 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 or 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.
Exhibit 8.3 LPR client on Win95/98 installation instructions
Obtain the ACITSLPR95.EXE file and place it in a temporary directory, such as c:\temp1.
Close all running programs on the desktop. The computer must be rebooted at completion of installation or the program will not work.
Click Start, Run and type in c:\temp1\acitslpr95. Click Yes at the InstallShield prompt.
Click Next, then Yes. The program runs through some installation and then presents a Help screen that explains how to configure an LPR port.
After the Help screen closes, the program asks to reboot the system. Ensure that Yes is checked, and click Finish to reboot.
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.
With the Printers folder open, right-click over the printer icon that needs to use the LPR program, and click on the Properties tab.
Under the Details tab, click the Add Port tab, then click Other.
Highlight the ACITS LPR Remote Printing line, and click OK.
The Add ACITS LPR screen opens. Type in the hostname of the UNIX system that the client spools through—mainprinter.ayedomain.com.
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.1
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.
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.
Leave the "Send data file before control file" box unchecked. This option is used only in rare mainframe spooling circumstances.
Click OK, and then click the Spool Settings button at the Properties page.
Make sure that the "Spool print jobs so program finishes printing faster" box is checked.
Make sure that "Start printing after last page is spooled" box is checked.
Make sure that "Disable bi-directional support for this printer" box is checked or greyed out.
Make sure that "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.
Click OK and then OK again to close the Printer Properties. The printer icon now spools through FreeBSD.
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.
Double-click on Main, Control Panel, then Network Settings.
In the Installed Network Software window, Microsoft TCP/IP Printing should be listed as well as TCP/IP Protocol.
Click the Add Software button to get the Add Network Software dialog box.
Click the down arrow and select TCP/IP Protocol and related components. Click Continue.
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.
Click on Start, Settings, Control Panel, and double-click on Network to open it.
Click on the Services tab. Microsoft TCP/IP Printing should be listed. If not, continue to steps 3 and 4.
Click Add, and then select Microsoft TCP/IP Printing and click OK.
Click Close. Follow the 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.
Click on Main and open it. Then click on Print Manager to open it.
Click on Printer, Create Printer. Select the appropriate printer driver.
Click the down arrow under Print To and select Other.
In the Available Print Monitors window select LPR port and click OK.
Enter the hostname of the FreeBSD printserver and the name of the printer queue and click OK.
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.
Click Start, Settings, Printers to open the printer folder.
Double-click Add Printer to start the wizard.
Select the My Computer radio button, not the Network Print Server button, and click Next. (The printer is a networked printer, but it is managed on the local NT system. Microsoft used confusing terminology here.)
Click Add Port and select LPR Port, and then click New Port.
Enter the hostname and print queue for FreeBSD printserver and click OK.
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.
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 with 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).
Under Windows NT 4.0, the change is shown in Exhibit 8.4.
Exhibit 8.4 Changing the Windows NT Registry
Windows NT 4.0
Run the Registry Editor (REGEDT32.EXE).
From the HKEY_LOCAL_MACHINE subtree, go to the following key:
On the Edit menu, click Add Value.
Add the following.2
Value Name: SimulatePassThrough Data Type: REG_DWORD Data: 1
Windows NT 3.51
Run the Registry Editor (REGEDT32.EXE).
From the HKEY_LOCAL_MACHINE subtree, go to the following key:
On the Edit menu, click Add Value.
Add the following.
Value Name: SimulatePassThrough Data Type: REG_DWORD Data: 1
Create an LPD key at the same level as the LPDSVC key.
Click the LPDSVC Key, click Save Key from the Registry menu, and then save the file as LPDSVC.KEY.
Click the LPD key created in step 5.
Click Restore on the Registry menu, click the file created in step 6, and then click OK.
A warning message appears. Click OK and then quit the Registry Editor.
At a command prompt window, type net stop lpdsvc, then net start lpdsvc.
If this fails, the client machine name is probably not in /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.