Printing to a Windows Printer from Unix
Adding the Printer
Finding the Windows Printer Name
Use smbclient to browse the shared printers from the Windows machine:
smbclient -L *windows hostname*
The result will include something along the lines of:
Sharename Type Comment --------- ---- ------- hpoffice Printer hp officejet 5100 series
Here, hpoffice is the shared name of the printer which we'll use later on.
Selecting the Foomatic Printer Driver
Take a look in /usr/lib/lp/model/ppd/system/foomatic for the Manufacturer and Model of your printer. It's quite a comprehensive list unless you've bought the very latest gizmo in which case you might need to make an educated guess at an alternative. In this case there are two alternatives for the HP 5110:
HP/HP-OfficeJet_5110-hpijs.ppd.gz HP/HP-OfficeJet_5110xi-hpijs.ppd.gz
Adding the Printer to Unix
This is now standard lpadmin country noting that:
- we'll call the printer hp5110 for the Unix client
- we specifiy a SAMBA name for the printer device and
- use the URI transport
lpadmin -p hp5110 -d smb://*windows hostname*/hpoffice -m uri -n /usr/lib/lp/model/ppd/system/foomatic/HP/HP-OfficeJet_5110-hpijs.ppd.gz accept hp5110 /usr/sbin/enable hp5110
What is Happening?
Very simply, lpadmin creates an ordinary printer (which is by default a PostScript printer) available on a given device. The magic lies in the PPD file and Foomatic which is a clever system to invoke GhostScript to convert the PostScript into the printer's own page description language.
Troubleshooting
If you need to specify a username and password to access resources from a Windows share then you'll need to modify the device entry to look like:
smb://username:password@hostname/sharename
For older versions of Solaris you may want to look at the OpenSolaris forum thread which refers to this FAQ entry.
Document Actions