Do the following to install CUPS. CUPS is the unix printing system used by OSX and Linux, see also the CUPS web site.
On the commandline:
sudo apt-get update sudo apt-get install cups-pdf cups-driver-gutenprint sudo usermod -a -G lpadmin pi
The last line makes your default Pi user pi
a printer adminsitrator, which is helpful when configuring the printer.
After this CUPS is up and running…but not accessile over the network
Although CUPS is running, it's webinterface is not accessible over the network. When you're accessing your Pi over the network, you need network access to conveniently CUPS on your Pi.
The following is similar to this page:
You should edit the config file /etc/cups/cupsd.conf
, on the command line:
sudo nano /etc/cups/cupsd.conf
Look for the following line:
Listen localhost:631
And replace it with:
Listen 0.0.0.0:631
This will open up remote access to the CUPS web interface.
You should also modify the security settings to allow remote access in /etc/cups/cups.conf
. To do so find all lines like these (3 occurences in total):
<Location /....> Order allow,deny </Location>
Change them by including a line Allow All
like this:
<Location /....> Order allow,deny Allow All </Location>
This opens CUPS access from anywhere on your network…. and even the internet if you don't have a proper firewall. So be careful!
For some reason iOS6 requires your printer to be able to handle the URF format. It's not that it's really used (yet), but in the future it may be - at this time URF seams equivalent with PDF.
To make CUPS pretend to be able to handle URF a few files need to be added. With the command line do:
sudo nano /usr/share/cups/mime/airprint.convs
Enter the following line:
image/urf application/vnd.cups-postscript 66 pdftops
Now at the command line:
sudo nano /usr/share/cups/mime/airprint.types
Enter the following line:
image/urf urf (0,UNIRAST)
This apparently does the trick. For now that is, maybe iOS7 introduces new surprises.
Now do the following on the command line have CUPS read the new config:
sudo service cups restart
Assuming your Pi's IP address is 192.168.254.184, you can access cups by accessing the following URL in your browser:
https://192.168.254.184:631/
This way you can configure CUPS. You'll probably get a warning about a bad certificate, but just ignore that.
When you initiate CUPS Admistrator activities, at a certain point you'll be asked to enter a username and a password. The username and the password are pi
and raspberry
(unless you changes the password - which you should have done).
In the middle of the page you'll see a list of items titled CUPS for Administrators
. Choose the item Adding Printers and Classes
.
Add Printer
. Push that button.Continue
button below the list.
Now you'll be on a page with fields Name
, Description
, Location
And Sharing
.
Now hit the Continue
button.
After a while CUPS will show a page allowing you te specify certain details.
Make:
probably CUPS guessed it right. If not correct it.Model:
probable CUPS guessed it right. If not correct it.Or provide a PPD file:
you don't want to use this.
Now hit the Add Printer
button below.
On the command line of the Pi enter:
lpstat -a
Your newly configured printer should be listed. If so, your printer is configured in CUPS! You did it!
Although your printer is configured in CUPS it's not visible for your iOS device (yet). Follow the next steps to make this happen.
To make your iOS device see your printer you need to configure Avahi-daemon which makes the printer visible to iOS devices by Zeroconf
or Bonjour
as the protocols are branded by Apple. For more information see this page.
Create a configuration file for your printer, enter the following on the command line:
sudo nano /etc/avahi/services/AirPrint-HPLaserJet.service
Replace the string HPLaserJet
with the name you chose for your printer during CUPS configuration. Now enter the following (suggestion: Cupy and Paste):
<?xml version="1.0" ?> <!DOCTYPE service-group SYSTEM 'avahi-service.dtd'> <service-group> <name replace-wildcards="yes">AirPrint HPLaserJet @ %h</name> <service> <type>_ipp._tcp</type> <subtype>_universal._sub._ipp._tcp</subtype> <port>631</port> <txt-record>txtvers=1</txt-record> <txt-record>qtotal=1</txt-record> <txt-record>Transparent=T</txt-record> <txt-record>URF=DM3</txt-record> <txt-record>rp=printers/HPLaserJet</txt-record> <txt-record>note=HP Color LaserJet CM2320fxi MFP</txt-record> <txt-record>product=(GPL Ghostscript)</txt-record> <txt-record>printer-state=3</txt-record> <txt-record>printer-type=0x2901c</txt-record> <txt-record>pdl=application/octet-stream,application/pdf,application/postscript,image/gif,image/jpeg,image/png,image/tiff,text/html,text/plain,application/vnd.cups-banner,application/vnd.cups-command,application/vnd.cups-pdf,application/vnd.cups-postscript,image/urf</txt-record> </service> </service-group>
Again: replace all occurences of HPLaserJet
with the Name you configured for your printer in CUPS. Be very precise about his!
http://www.penguintutor.com/linux/printing-cups