How to print to a printer attached to Windows box from Linux
Basically, you have two options. (assuming you will use CUPS, the most common printing daemon) The LPD way and the Samba way. The Samba way is considered more simple and painless. Nevertheless you will need appropriate Linux driver for the printer. From the printing driver point of view there's no difference if the printer is attached via USB (or whatever) or via Windows box, so all printers working locally should work. (and vice-versa)
Option 1: The LPD way
- Configure the Windows PC (2000 or XP).
Go to "Start" --> "Settings" --> "Control Panel" --> "Add/Remove Programs" --> "Add/Remove Windows Components". Click "Other Network File and Print Services", then click "Details". Select the "Print Services for UNIX" check box, then click "OK". A new service called "TCP/IP Printing Service" will be created. (You may want to set it to start automatically on startup.)
- If you have Windows XP Service Pack 2 installed, port 515 is blocked. You have to poke this hole in the firewall before LPD printing will work.
Open Network Connections Right-click on the appropriate network interface and select Properties. Click on the "Advanced" tab and the "Settings" button to open the firewall settings. On the firewall settings, click on the "Exceptions" tab, then the "Add Port" button. Name the service (LPD, for example), and enter port number 515. Click OK a couple times to close this and the previous windows.
- Share your Windows printer if you haven't already done so. Be sure to use a simple shared name, like "ml1210" or "hp7350".
- Install CUPS, samba and gutenprint. Note, it is crucial to include the USE variable below for gutenprint drivers, otherwise the gutenprint drivers are not installed by default.
echo "net-print/gutenprint ppds" >> /etc/portage/package.use echo "net-print/cups samba ppds ldap" >> /etc/portage/package.use echo "net-fs/samba cups" >> /etc/portage/package.use emerge -av cups samba gutenprint
- Start the CUPS and Samba daemons.
/etc/init.d/cupsd start /etc/init.d/samba start
- Configure the Linux PC.
Open http://127.0.0.1:631 in your favorite web browser. Click on "Manage Printers" --> "Add Printer". Enter a Name for the printer (Location and Description are optional). Select "LPD/LPR Host or Printer" as the Device. Enter the Device URL (for example: lpd://192.168.0.2/HPLaserJ) Select your Printer from the Make list.
- Now open an application and try to print something!
Option 2: Using Samba
You don't need to install "Print Services for UNIX"; you just need to share your Windows printer via the normal Samba interface. Be sure to use a simple shared name, like "ml1210" or "hp7350", that doesn't include spaces.
Then, on your Linux PC:
- Connect to http://127.0.0.1:631 using a web browser.
- Click on the "Add Printer" button.
- Enter a Name for the printer (Location and Description are optional).
- Select "Windows Printer via SAMBA" from the Device list.
- Enter the Device URI, using your Windows credentials:
- If the above Device URI doesn't work try using inserting your domain name using the following syntax:
- Select your Make of Printer from the list, or upload a third party driver.
- Select the Model and click Next to finish.
NOTE: On some old versions of CUPS you have to run
ln -s `which smbspool` /usr/lib/cups/backend/smb
and then restart CUPS and Samba, in order for the printer to show in the device list.
If your printer isn't on the Make list
- You need to get a specific "ppd" file for your printer. Get it from LinuxPrinting.org. (If you have an HP printer, see the supported printer list, find your printer, and look in the Backend Solution column to determine which driver to use. Then emerge hpijs or hplip depending on what the driver for your printer is.) Information about Canon Pixma Series is here
- If the driver on LinuxPrinting.org indicates gimp-print, you need to add the USE="ppds" in your emerge of gimp-print, otherwise, the driver list is not installed by default.
- Copy the downloaded ppd file to the directory /usr/share/cups/model/ (gimp-print emerge will automatically install all available drivers).
- After the driver is installed or gimp-print is re-emerge'd, restart cupsd to reload the driver list.
"Unable to copy PPD file!" Error
- Try running chmod -R a+rX /usr/share/cups/model as root.
- Try a different print driver (for example, with Epson Stylus CX-4800, the foomatic+gutenprint driver doesn't work even though it's "recommended").
- An defective or unsupported PPD will cause this error also.
"Quota limit reached" Error
- Try reinstalling the printer driver.
- Google suggests reading this.
- Try looking at the log files on the /var/log/cups directory.
tail -f /var/log/cups/* will do the job. Look for lines that looks like this:
I [16/Apr/2007:15:50:06 -0400] Started "/usr/lib/cups/cgi-bin/printers.cgi" (pid=20037) I [16/Apr/2007:15:50:06 -0400] Denying user "guest" access to printer "HP_Net"...
If you get that, edit the printer in the web interface of CUPS, go to the "Set Allowed Users" tab and add the user there (if you have more than one user, you need to separate them using comma, like this: user1,user2,userN). That fixed the "Quota limit reached" error to me...
Removing all the entries in there fixed the problem for me.
If You Still Can't Print
If you still can't print and you see "Hint: Do you have ESP Ghostscript installed?" in /var/log/cups/error_log, just re-emerge ghostscript with cups support. You may also want to edit /etc/cups/cupsd.conf and set LogLevel to debug, restart cups and try to print again. /var/log/cups/error_log will contain a more detailed error message which may assist you.
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.