HomeBlogAirPrint with Ubuntu 10.10

my random thoughts

take 'em or leave 'em

AirPrint with Ubuntu 10.10

HomePrintE-mailPdf

 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!


Gravatar
Ken 01.10.2012 (00:54:47)  
 

Worked great on my iPad 3 and HP Deskjet F4280. Thanks!

 
   
       
Gravatar
Narobni 13.06.2012 (08:16:08)  
 

Thank you very much for this solution! It works perfect with both iPad 2 & 3 on my Ubuntu 10.04 server with a HP DeskJet-840C.

 
   
       
Gravatar
igi 28.05.2012 (23:48:14)  
 

if you have a firewall, then you should open port 5353 for UDP traffic. Otherwise avahi will stop advertising the printer after a while...

 
   
       
Gravatar
Kintaro 21.04.2012 (03:13:28)  
 

works like a charm!!!

thank you

 
   
       
Gravatar
Michael 14.04.2012 (19:10:53)  
 

Awesome and then some! Worked like a charm. Thanks!

 
   
       
Gravatar
zhound 16.02.2012 (17:13:34)  
 

I just intalled ubuntu 11.10 with all my printers. Avahi-daemon did not automatically advertise the printers. I had to generate the service files. Now avahi-discover can see the printers, but the iOS devices still can't see them. Am I missing something?

 
   
       
Gravatar
Iury 14.02.2012 (16:01:22)  
 

It did not work for me. I got ipad2 runing ios 5.0.1.
Any help?

 
   
       
Gravatar
Mathew 24.01.2012 (19:17:26)  
 

Hi,

Thanks for the this tutorial. All printing worked from iPhone & iPad but only thing is it takes about 2-4 minute to print unlike printing via samba. Other than this printing delay, printing is fine.


Does anybody know a setting to improve this?

Thanks

Mathew

 
   
       
Gravatar
Adam Monsen 01.01.2012 (15:08:23)  
 

Worked perfectly, took me approximately five minutes to set this up for myself. Thank you!!

 
   
       
Gravatar
Dave Hay 28.12.2011 (11:02:23)  
 

laugh

Excellent tip, works like a dream. Have blogged my own experiences here -> http://portal2portal.blogspot.com/2011/12/printing-from-ipad-2.html

 
   
       
 

Smileys

:confused: :cool: :cry: :laugh: :lol: :normal: :blush: :rolleyes: :sad: :shocked: :sick: :sleeping: :smile: :surprised: :tongue: :unsure: :whistle: :wink: 

  1000 Characters left