How to print from a linux box to a windows network printer

edited May 2013 in Hardware
Hello everyone:
Today is National Tutorial Day (kidding). If you're wondering why you cannot print from your linux box to a Windows network printer that is attached to the Windows computer, such as a desktop running Windows XP or a server running Server 2000, 2003, and your documents won't print and worse yet, when you cancel the document from printing either from your linux box or Windows PC, your printer will get a fatal crash (DeskJet F4100 Series from HP fatal error: paper type lights, ink (color and b/w) lights, load paper light, and power light flashes constantly, with an E in the start copy box (other printers, like the PhotoSmart 3210 printer, and the HP PSC 750 have the status display, like Scanner Error (tutorial coming soon for fixing an HP PSC 750 - documentation only). This causes the printer owners and linux lovers to have frustrations when trying to print out a document, or picture.

The major problem and cause:
The cause of the problem is in the Windows Print Query, it will state that only 64KB/total size is stuck at that spot.
The problem is the "enable bidirectional support" is enabled
Another issue (minor) is the LPD support in Windows is disabled by default. You probably won't need this, but this I recommend since you don't have to input your username and password every time you print out a document by using Samba.
Firewall rules deny ports 515 (LPD), SMB (137-139), and IPP (631) both TCP and UDP. Open the Windows Firewall Advanced Settings, click on Inbound Rules and Outbound Rules, add these ports in the list for both TCP and UDP (separate rules). Note: The outbound rules says block, click allow (first option), and set the rules for only Private and Domain, not Public, and name the rule, such as Network Printing (TCP/UDP).

This applies to hardware-based firewalls (PC-based), like Smoothwall, type in your smoothwall's hostname or IP address (such as or https://smoothwall:441) hover over networking outgoing, type in the ports listed above. Note: SMB is already enabled by default, but add the ports again just to be on the safe side, comment in the port number (optional), and click Add. Do the same for Networking > internal (click on the internal tab), and type in the source IP address (can be either the purple > green scenario or green > green [just in case]) and the destination IP address (Windows PC or Linux Box*) with the port numbers 137-139, 515, and 631 for both TCP and UDP, and comment that port (optional), and click Add. Note: Purple > Green requires OpenVPN enabled and an OpenVPN client on a network.

That's portion of the resolution. The next step is to disable bidirectional support on Windows 2000/XP/2003/Vista/2008/7/2008 R2. In Windows 2000/XP/2003, go to Start > Settings > Printers and Faxes (XP/2003, go to Start > Control Panel Printers and Other Hardware, and click on Printers and Faxes).
Right-click on the target printer, click on Properties, click on Ports, and underneath the port listing, uncheck the enable bidirectional support, and click Apply, OK.

For Vista/2008/7/2008 R2, click Start, type in Printers (Devices and Printers - 7/2008 R2) and right-click on the target printer, click properties, click on ports, and disable the bidirectional support (under the list of ports), and click Apply, OK.

On your linux box (Ubuntu^, Fedora, etc.), go to your Printer Settings by going to either activities (Fedora), or the Gear (Ubuntu^), double-click on your printer, and click Print Test Page.

*Your Linux Box can also be used as a Printer Server and Windows can print to your shared Linux Printer.
^Kubuntu, type in Printers and hit enter; follow the same exact steps.

As for LPD/LPR in Windows, follow the tutorial here
Note: LPD/LPR for Windows allows you to install your shared Windows Network Printer or Unix (Linux or Mac OS) Network Printer as well.
Sign In or Register to comment.