Sunday, February 7, 2010

Printing from Unix to Windows (Part 1)

Last time we talked about LPR/LPD Printing. This time, we’ll see how to put it into practical use.

Let's say you have a Unix machine and an XP machine, and you have an HP printer locally attached to your XP machine. You want to print a file on your Unix machine, but you don’t want to disconnect your HP printer from your XP machine and connect it to your Unix machine just to print that file, and then reconnect the printer back to your XP machine. Is there a better way of doing this?

Yes, this is how:

First, you need to add certain windows component on your XP machine to make this happen: On your XP machine, click Start -> Control Panel -> Add or Remove Program, then click "Add/Remove Windows Components" on the left pane.

Scroll down to “Other Network File and Print Services”, click the Details button.

Unix to windows printing

Select “Print Services for Unix”, then click OK.

Unix to windows printing

Click “Next”, and it will start installing this component. Depending on what other components you have installed on your system, it may ask you for the Windows CD.

Next, click Start -> All Programs -> Administrative Tools -> Services. Scroll down and you should see the “TCP/IP Print Server”. This is the new service installed. It is started., and the start mode is manual.

Unix to windows printing

You may want to change this service to start automatically every time you start your system. To do so, highlight “TCP/IP Print Server” and right-click, and select Properties from the context menu. Change the startup type to Automatic, and click OK.

Unix to windows printing

Now you have the lpd (line printer daemon) running. Next is to set up a print queue.

Click Start -> Printer and Faxes. Let’s say you have a printer called “HP LaserJet 4000” locally attached to your XP machine. Remove the spaces in the printer name by renaming it to “HPLaserJet4000” because Unix doesn’t like printer names with spaces.

That's it! The last thing you need to know is the machine name or the ip address of your machine. If you don’t know the info, read this article to find out how. Fill in the name of the printer or print queue on that server.

Let's say if your machine's ip address is 192.168.1.123.

Next, you have to define your HPLaserJet4000 printer on your Unix machine. Once done, you can start printing from Unix using the lpr command. The syntax varies with different flavors of Unix/Linux. The command may look something like this:
lpr -PHPLaserJet4000 myfile.txt

You can even do the test using another windows machine. On another windows machine, open up a command window (Start -> Run, then type cmd). In the command window, type:
lpr –S 192.168.1.123 –P HPLaserJet4000 myfile.txt

If it complains that "Host 192.168.1.123 is unknown", try pinging your XP machine. If it fails to ping your XP machine, most likely it's the firewall settings on your XP machine that's preventing this. Start -> Control Panel -> Windows Firewall. You probably will have to adjust your firewall settings.

It’s worth noting that this works not just for any locally attached printer (via the LPT1: port, or a USB port), it also works for any printer accessible from your XP machine, be it a TCP/IP printer, or a printer attached to a print server.

That means, you have this set up in an office environment so that printouts from any application running on a non-Windows system (such as Unix/Linux systems or any legacy systems) can be re-directed to and printed on a Windows system – as long as the non-Windows system has the lpr capability.

Part 2



Click here to see a complete list of articles

To contact us: uniprint.user@gmail.com.


No comments:

Post a Comment