Airprint on Fedora 15

It is possible to AirPrint from your iPhone or iPad to your network attached (or USB) printer using Fedora 15 and CUPS. No additional software on your iPhone is needed, you just need to make sure Avahi, CUPS and your Firewall is configured properly.

First, make sure you have Avahi and CUPS installed. These are part of the default installation, so you should have some version of them installed.

bash$ rpm -q cups avahi
cups-1.4.8-2.fc15.x86_64
avahi-0.6.30-3.fc15.x86_64

Additionally, If you are running Gnome3 and find that the System Settings -> Printers lacks some configuration options, use the Fedora system-config-printer tool from the command line to configure your printers. The Gnome3 interface under System Settings -> Printers will see the configurations you make with system-config-printer.

If you don’t have the packages you need installed, use YUM to install them:

bash$ sudo yum install cups avahi system-config-printer

If you had to install the packages, make sure that CUPS and Avahi are started and enabled to start on boot. Otherwise, skip this step.

bash$ for SERVICE in cups avahi; do
> /sbin/chkconfig $SERVICE on
> /sbin/service $SERVICE start
> done

First, you will need your printer to be installed and configured on the Fedora 15 system. Do this with System Settings -> Printers or system-config-printer. If your printer is already installed and working, skip this step.

bash$ sudo system-config-printer

Once your printer is installed and working, note it’s name in CUPS. For instance, my printer is called Epson.

bash$ lpstat -p
printer Epson is idle.  enabled since Sun 02 Oct 2011 08:20:54 PM EDT
                	Ready to print.

Next, you will need to configure your printer with Avahi (a system which facilitates service discovery on your local network). Do this by editing a new service file under /etc/avahi/services. In this example, I name the file printer.service, but any name will work.

bash$ sudo vim /etc/avahi/services/

Now, insert this XML into the file making sure to change ‘Epson’ to your printer name as listed in lpstat -p. Feel free to also change the options for your printer in the various <txt-record> entries.

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
      <name>Epson</name>
      <service>
            <type>_ipp._tcp</type>
            <subtype>_universal._sub._ipp._tcp</subtype>
            <port>631</port>
            <txt-record>txtver=1</txt-record>
            <txt-record>qtotal=1</txt-record>
            <txt-record>rp=printers/Epson</txt-record>
            <txt-record>ty=Epson</txt-record>
            <txt-record>adminurl=http://printers.00:631/printers/Epson</txt-record>
            <txt-record>note=Epson</txt-record>
            <txt-record>priority=0</txt-record>
            <txt-record>product=virtual Printer</txt-record>
            <txt-record>printer-state=3</txt-record>
            <txt-record>printer-type=0x801046</txt-record>
            <txt-record>Transparent=T</txt-record>
            <txt-record>Binary=T</txt-record>
            <txt-record>Fax=F</txt-record>
            <txt-record>Color=T</txt-record>
            <txt-record>Duplex=T</txt-record>
            <txt-record>Staple=F</txt-record>
            <txt-record>Copies=T</txt-record>
            <txt-record>Collate=F</txt-record>
            <txt-record>Punch=F</txt-record>
            <txt-record>Bind=F</txt-record>
            <txt-record>Sort=F</txt-record>
            <txt-record>Scan=F</txt-record>
            <txt-record>pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/urf</txt-record>
            <txt-record>URF=W8,SRGB24,CP1,RS600</txt-record>
      </service>
</service-group>