HomeBlog

my random thoughts

take 'em or leave 'em

AirPrint with Ubuntu 10.10

 I just upgraded my iPad to iOS 4.2.1.  As most have figured out by now, AirPrint is not available for printers outside of the chosen few HP printers.  So, of course I set out to find a way to make it happen with my Samsung multifunction printer.  To my delight, Ubuntu comes with all you need pretty much out of the box.  All I had to do was create a printer service file for avahi, make a couple changes to CUPS config, then restart cups and BAM, I'm printing from my iPad.

Okay, so here are the details.  This of course assumes that you already have an installed and functioning printer within Ubuntu.

First, let's create the service file for avahi.

sudo pico /etc/avahi/services/printer.service

Insert the following into the file and save by holding the control key then hit O

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name>My Printer</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/My-Printer-CUPS-Name</txt-record>
    <txt-record>ty=My Printer</txt-record>
    <txt-record>adminurl=http://198.168.1.4:631/printers/My-Printer-CUPS-Name</txt-record>
    <txt-record>note=My Printer</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>
  

 

The things to change are in red. My Printer can be anything you want.  My-Printer-CUPS-Name has to be the name CUPS has assigned to the printer.  You can obtain this by going to System -> Administration -> Printing or browsing to CUPS web admin.  In  Ubuntu's printer manager, it will be whatever is listed underneath the printer image.  The IP address in the adminurl should be the IP of the computer that has the printer installed.  

Of course you can change the options such as Duplex, etc based on your printers features.

Now, you need to change a couple things with CUPS config.

sudo pico /etc/cups/cupsd.conf

Make sure you have the following:

ServerAlias *
Port 631
Listen /var/run/cups/cups.sock

 

Now go back to System -> Administration -> Printing and click Server -> Settings.  Make sure "Publish shared printers connected to this system" is checked.  Click OK.  Restart the CUPS server.

sudo /etc/init.d/cups restart

You should now be able to print from the iPad!

and tagged with ipad, airprint, ios, 4.2, apple, ubuntu, maverick, 10.10, iphone, CUPS

43 comments.