|
发表于 2005-4-30 21:30:16
|
显示全部楼层
可以考虑用cups网络打印功能,不用samba,我曾成功配置过。请参考下面的文章:
http://www.owlfish.com/thoughts/winipp-cups-2003-07-20.html
How to make Windows use CUPS IPP
Background
I originally wrote these notes as a result of trying to connect a Windows 2000 machine to a printer hosted under Debian. Based on the feedback I've received I have done some more experimentation, this time connecting a Windows XP machine to a printer hosted under Fedora.
The steps outlined here should allow you to connect Windows 2000 or XP to a printer hosted by CUPS running on any Linux distribution. My original instructions for connecting Windows 2000/Debain are included at the bottom of this page and may still apply to old versions of CUPS.
Windows XP / Fedora CUPS
There are two ways to configure a printer under Windows XP so that it works with CUPS:
* As a Postscript capable printer. This allows your Windows XP machine to print to your normal printer queue with no printer-specific configuration.
* As a printer with a particular Windows XP driver. On Fedora some additional configuration of CUPS is required, on other Linux/Unix systems it may work out of the box.
Common Steps
Share the CUPS Printer
One thing both of these options have in common is the requirement that the printer queues you create are shared. In Fedora do this in the "rinter configuration" tool (from System Settings -> Printing) by selecting the printer queue, followed by "Action -> Sharing...".
Under other versions of Linux/Unix you may have to edit the CUPS configuration files directly, see Granting permission later in this document.
Hostname lookup
Another common step is to ensure that hostname broadcast by CUPS is accessible from the Windows XP machine. If your CUPS machine is accessible using a name rather than just an IP address then you don't need to do anything for this step. If the CUPS machine is not accessible via it's hostname then you need to set a mapping between the CUPS hostname and its IP address in the Windows hosts file. Under WindowsXP the host file is in C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS, in Win2k replace WINDOWS with WINNT. The format is simple:
# Example hosts entry
192.168.0.3 rock
Under some CUPS server configurations you will be able to use the IP address instead of the hostname, but often only a hostname will work.
Postscript Printing
To use a printer queue as a Postscript printer requires a Windows XP Postscript printer driver, such as the built-in MS Publisher Imagesetter or this freely available one from Adobe.
Built-in MS Publisher Imagesetter
To use the MS Publisher Imagesetter driver, use "Add Printer" to add a new network printer, select "Connect to a printer on the Internet..." and enter the URL for your printer queue (e.g. http://rock:631/printers/Epson). When prompted for a driver select a Manufacturer of "Generic" and the Printer "MS Publisher Imagesetter".
Adobe Driver
To use the Adobe driver simply run the installer, select "Network Printer", enter the URL of your printer queue (should be of the form http://hostname:631/printers/PrinterName), and then select "yes" when prompted. You can either use the "Generic PostScript Printer" option, or "Browse" for the printer specific PPD file created by CUPS (located in /etc/cups/ppd/PrinterQueueName.ppd on the Linux machine).
Using a Printer Driver
If you have a Windows XP printer driver available for your printer you can use this instead of the Postscript driver. In some configurations you can use the existing printer queue, and just select the correct printer driver in Windows.
Under Fedora, and possibly other systems, CUPS needs to be configured to accept printer data that is already in its native form. There are two different approaches that can be used: either add a raw printer queue, or alter the CUPS configuration files with a text editor.
Add a raw queue
Adding a raw printer queue can be easily done through Fedora's "rinter configuration" tool (from System Settings -> Printing). To do this select the "Generic" drop down when you reach the "rinter model" step of the wizard, then select "Raw Print Queue". When Fedora prompts you to print a test page, say "No". This printer queue will only be useful to those machines configured with a printer driver, and can not be used by applications running on Fedora. (Also remember to share the queue!)
In Windows XP use "Add Printer" to add a new network printer, selecting "Connect to a printer on the Internet", and using a URL of http://hostname:631/printers/RawPrinterQueueName. Select the printer driver for this printer as you would for a locally connected printer.
Modify CUPS Configuration
If you don't wish to create a raw printer queue then you can instead make the following changes to your CUPS mime.types and mime.convs configuration files. Both of these files contain a commented out option starting with "#application/octet-stream". Enable these options by removing the "#", and then restart CUPS.
Windows 2000 / Debian
These were the steps that I took to connect my printer, hosted under Debian, to my Windows 2000 machine. This environment is no longer available to me for testing, so I'm not able to vouch that each of these steps is absolutely required.
Create a class
The major configuration change I had to make under CUPS was adding a class. Based on feedback I've received it seems that only older combinations of CUPS and Windows require this (e.g. Debian Woody and Windows 2000), and newer versions do not.
I could not make Win2K talk to my printer directly, but it was able to work with a class that held that printer. To do this go to the CUPS admin screen on the Unix machine(e.g. http://localhost:631/admin) and select "Add Class". Enter a name, location and description as prompted and select continue. Next select the printer you wish to share as a member of this group. Select continue to save the class.
Granting permission
For an IPP client to be able to connect to CUPS it must have permission. On Debian systems, and probably others, the default is for only local connections (i.e. those from 127.0.0.1) to be allowed. To allow connections from across the network alter the <Location> directive in the cupsd.conf file (found in /etc/cups/). For example to enable both local connections, and those from clients in the 192.168.0.* range use:
<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
Allow From 192.168.0.*
</Location>
To give permission for all clients from all network connections replace 192.168.0.* with All.
Win2k Configuration
I had two major problems setting up things on the Windows 2000 machine: getting Windows to see the Linux host and using the correct URL.
In theory Windows should be able to connect to an IP address, however I never managed to get this to work, but it could successfully use a hostname. To set a mapping between your CUPS hostname and its IP address you need to put an entry in the Windows hosts file. Under Win2k the host file is: C:\WINNT\SYSTEM32\DRIVERS\ETC\HOSTS. The format is simple:
# Example hosts entry
192.168.0.3 rock
Now you can set up the new network printer. In the Control Panel select "Add Printer", "Network Printer", and then "Connect to printer on the Internet or your intranet". The URL I use is:
http://rock:631/classes/Home
Replace 'rock' with the hostname of your Linux server, and replace 'Home' with the name of the class that you defined earlier.
Depending on your configuration of CUPS you will probably be prompted to install a printer driver for the network printer. Doing this is the final step, after that you should be able to print from Windows directly to a CUPS printer using IPP! |
|