Gentoo Wiki ArchivesGentoo Wiki

CUPS/Print_to_a_Microsoft_Windows_printserver_from_Linux

Contents

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

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.)
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.
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
Note: ppd is enabled by default on the 2006.1/desktop profile
/etc/init.d/cupsd start
/etc/init.d/samba start
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.

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:

smb://Username:Password@HOST/PrinterShare
smb://Domainname\Username:Password@HOST/PrinterShare

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

  1. 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
  2. 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.
  3. Copy the downloaded ppd file to the directory /usr/share/cups/model/ (gimp-print emerge will automatically install all available drivers).
  4. After the driver is installed or gimp-print is re-emerge'd, restart cupsd to reload the driver list.
/etc/init.d/cupsd restart

"Unable to copy PPD file!" Error

"Quota limit reached" Error

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.

Retrieved from "http://www.gentoo-wiki.info/CUPS/Print_to_a_Microsoft_Windows_printserver_from_Linux"

Last modified: Thu, 25 Sep 2008 03:56:00 +1000 Hits: 35,306

Created by NickStallman.net, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.