Enable iOS AirPrint with any printer supported by CUPS
Download this article as a single PDF document
AirPrint is a wireless printing technology for iOS devices.
This HowTo will explain how to enable AirPrint on any printer that is supported by CUPS.
The idea behind is that avahi sends announcements which make iOS think that the printer is AirPrint compatible.
Of course this works only for iOS versions that support AirPrint.
- Debian Linux Wheezy
- CUPS 1.5.3
- Epson Stylus Photo PX 720WD
First we need to install some packages.
# apt-get install cups-pdf avahi-daemon python-cups cups-driver-gutenprint # apt-get install foomatic-db foomatic-db-engine foomatic-filters
If you have a HP printer you should also install hplip
# apt-get install hplip
Edit the CUPS' config file
after the line "Listen /var/run/cups/cups.sock" paste this
Listen IP-OF-YOUR-CUPS-SERVER:631 PreserveJobHistory No FileDevice Yes ServerAlias *
# Restrict access to the server... <Location /> Order allow,deny </Location> # Restrict access to the admin pages... <Location /admin> Order allow,deny </Location> # Restrict access to configuration files... <Location /admin/conf> AuthType Default Require user @SYSTEM Order allow,deny </Location>
# Restrict access to the server... <Location /> Order allow,deny allow @LOCAL </Location> # Restrict access to the admin pages... <Location /admin> Order allow,deny allow @LOCAL </Location> # Restrict access to configuration files... <Location /admin/conf> AuthType Basic Require user @SYSTEM Order allow,deny allow @LOCAL </Location>
Create new mime files - This is needed for iOS 6 to recognize CUPS print shares!
# echo "image/urf urf string(0,UNIRAST<00>)" > /usr/share/cups/mime/airprint.types # echo "image/urf application/pdf 100 pdftoraster" > /usr/share/cups/mime/airprint.convs
Open the local CUPS page in a web browser:
If you have a network printer (LAN,WiFi, JetDirect), turn it on. If your printer is USB only, connect it to your CUPS server.
Go to "Administration" and click on "Add Printer".
When asked for credentials use
login: root password: root's password
CUPS will start looking for your printer. Select it, click next, allow sharing, and click next again.
On the next page you must select the "driver". Usually there are several possibilities.
If unsure, go to http://www.openprinting.org and see which PPD works best with you printer.
For HP printers always go with hpcups. Finish the installation.
Now go to "Printer" in the bottom right of the page, press the "Maintenance" drop-down menu and select "Print Test Page" to make sure it works properly.
With the aid of Timothy J Fontaine's python script, we can generate avahi announcements that will make iOS think that our printer is AirPrint capable.
All you need to do is:
# /etc/init.d/avahi-daemon start # mkdir /opt/airprint # cd /opt/airprint # wget -O airprint-generate.py --no-check-certificate https://raw.github.com/tjfontaine/airprint-generate/master/airprint-generate.py # chmod +x airprint-generate.py # ./airprint-generate.py -d /etc/avahi/services # /etc/init.d/avahi-daemon restart # ls /etc/avahi/services/
You should see something like "AirPrint-Name-of-your-printer".
Just in case I attached the script to this post.
On the iOS side there's nothing you really need to configure.
Just go to an app that supports printing, for example mail or goodreader and select print.
Everything works out of the box.
The original howto which first appeared on the Arch Linux ARM wiki: http://archlinuxarm.org/support/guides/applications/cups-apple-airprint
That's all folks.
factro said ...
Thank you sooo much...:D..it works
Raqel said ...
<comment date="2013-01-08T20:03:02Z" name="Raqel"> The developer reelesas of OS/X had support for exposing CUPS queues as AirPrint queues. Apple pulled that support. As near as anyone can tell there was no technical reason for that. So speculation is rampant that the removal was patent-related. </comment>
Lala said ...
<comment date="2013-01-09T06:49:02Z" name="Lala"> This is one of those things where you could keep aidndg to a list for days even though I'm quite happy with the current iOS.1) I think my number one is the multi-tasking system. Yes, we now have multi-tasking but it's a bit clunky. I want the ability to specify which Apps will stay in the background. I also want to be able to clear out everything easily, rather than have to stop each App individually. I also wants some fast way of switching Apps maybe a three finger swipe as has been rumoured.2) While I might not use it, the lack of a today screen is ridiculous.Bob </comment>
Luciano said ...
<comment date="2013-01-10T11:10:09Z" name="Luciano"> The purchases I make are etnierly based on these articles. </comment>
John said ...
<comment date="2013-02-07T01:49:52Z" name="John"> This works perfectly, however may I suggest at line:
"IP of cups server" or something similar
When I first saw it, I thought you meant IP of the printer! </comment>
srott said ...
<comment date="2013-02-08T18:09:47Z" name="srott"> I had to use Listen 0.0.0.0:631
because of dhcp
Rick said ...
<comment date="2013-02-10T19:19:45Z" name="Rick"> Hi and thank you for your guide. As John mentions the "IP-OF-YOUR-DEVICE" can easily be understood as IP of the printer...
Anyway, I got an issue. Even though I find the printer on my iPhone now I'm not getting anything printed.
All the best, Rick </comment>
YazzY said ...
<comment date="2013-02-11T09:35:49Z" name="YazzY" signature="YazzY"> Thanks. I changed that config line to IP-OF-YOUR-CUPS-SERVER which indeed makes more sense. </comment>