Page 1 of 2

Enable iPad AirPrint on Mint Printer ( No longer valid )

Posted: Sun Nov 28, 2010 1:08 pm
by altair4
NOTE: As mentioned by member: BonjourPrinter, this HowTo is no longer necessary if you are running the current levels of Mint:
BonjourPrinter wrote:These instructions should not be followed under any circumstances anymore!
Discovery of a Mint/Ubuntu attached printer from an iPad pretty much works out of the box as long as you have shared the printer, instructed the CUPS server to publish that printer, and have made sure that the avahi-daemon is running.

**********************************************************************************************************************************************
My wife owns an Apple IPad. A recent update to the OS now allows printing via something called AirPrint. According to the reports on AirPrint:
The good news is: AirPrint is incredibly seamless. The bad news is: it currently only works with 10 printer models—all of them from HP. On December 27th, HP will release six more AirPrint-enabled printers. Apple claims the number of AirPrint-ready printers will increase down the road, as will the number of manufacturers.
Well let's see, apple created ( assimilated ) two technologies that covers printing: CUPS and ZeroConf (avahi). Both of these exist in Linux so I figured there must be a way to do this with any printer attached to a Linux PC. Interestingly avahi is broken in Mint because of something Ubuntu did but there's a way around this as well. Did some googeling and did some experimenting and came up with this procedure:

First: Make sure your printer works locally and that it has been "shared" and "published". If needed refer to this HowTo on how to do that:
http://forums.linuxmint.com/viewtopic.php?f=42&t=28397

I have an HP printer which I called HP970 ( and so old it's certainly not AirPrint enabled ) attached to Mint9.

[1] Install the following packages:

Code: Select all

sudo apt-get install avahi-discover
sudo apt-get install python-lxml
[2] Download a python script that will be used to extract printer information and build the avahi printer services:

Code: Select all

https://github.com/tjfontaine/airprint-generate
[3] Extract the downloaded tar.gz file

[4] Open a Terminal and change to the download directory and run the python script:

Code: Select all

./airprint-generate.py
[5] Copy the avahi printer service file to the avahi services directory:

Code: Select all

sudo cp AirPrint-HP970.service /etc/avahi/services
Note: It adds "AirPrint" in front of your existing printer name.
[6] Restart the avahi service:

Code: Select all

sudo service avahi-daemon restart
[7] Run the avahi service discover applet and make sure the printer is listed:

Code: Select all

avahi-discover
[8] Edit the cups configuration file as root:

Code: Select all

gksu gedit /etc/cups/cupsd.conf
[9] Add the following line:

Code: Select all

ServerAlias *
To this section so that it looks like this:
LogLevel warn
MaxLogSize 0
SystemGroup lpadmin
# Allow remote access
Port 631
Listen /var/run/cups/cups.sock
ServerAlias *
# Share local printers on the local network.
[10] Restart cups:

Code: Select all

sudo service cups restart
Although it wasn't apparent to me how one does this my wife tells me that you should be able to print from safari, photos, and Mail.

As a side benefit anyone who owns a Mac or even another Linux machine now has another option to access a remote printer as the "Printing" applet that is used to add a new printer now has another option under Network Printer: Airprint HP970@altair. This effectively repairs what Ubuntu broke in avahi.

It is my sincerest hope that this works for you as is because in all seriousness my wife does not allow me much time on her growing list of apple products for fear that I will tinker with them. :wink:

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sun Jan 02, 2011 4:35 pm
by mytekcontrols
This initially worked great on my system (Isadora Version 9) when I followed all the steps. However after reboot, AirPrint no longer sees any of my printers.

If I reissue the following command in the Terminal:

Code: Select all

sudo service avahi-daemon restart
Then my iPad will once again see all my attached printers.

My solution was to edit the rc.local file:

Code: Select all

sudo gedit /etc/rc.local
Add the following line BEFORE the "exit 0" line.

Code: Select all

service avahi-daemon restart
And SAVE the rc.local file. This change will insure that the Avahi service automatically restarts after rebooting the computer.

Maybe not the best fix, but it does work for me.

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sun Jan 02, 2011 4:57 pm
by altair4
Thanks for the feedback. I was wondering if anyone saw this topic :lol:

That's too bad that avahi fails to start. I wonder if it's another "upstart" problem. Perhaps a script in /etc/network/if-up.d that restarts the service would work as well. Your way is probably cleaner.

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sun Jan 02, 2011 7:24 pm
by mytekcontrols
I greatly appreciated your tutorial, and other then the slight glitch I experienced, it works really well with my iPad. And dare I say that I probably won't be the only one who sees this post and benefits from it. Basically it gets past a limitation in the iPad's iOS that would have required buying a new printer in order to have such a seamless print ability. Although it does require using my Linux machine as a print server, this is acceptable since I often have it ON and idling in the background throughout the day. And unlike some of the other print solutions, it is the only one that I know of for a Linux based system that is able to take full advantage of the AirPrint function. Most other solutions make you open a separate app as well as install a special client on the computer sharing the printer.

So thanks for your tutorial.

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sat Jan 08, 2011 9:31 am
by mytekcontrols
Well apparently my fix isn't working after all. It still loses connectivity after rebooting the computer. So I need a foolproof method of making the printers stick and be accessible on my iPad using AirPrint via Avahi.

Unfortunately I'm not a linux guru, so not really sure what my next move should be.

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sat Jan 08, 2011 10:54 am
by altair4
Just to make sure I understand the problem:

You loose printer connectivity even though avahi's status is "running" ?

Or the fix of placing a script in rc.local doesn't always start avahi-daemon successfully?

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sun Jan 09, 2011 11:39 am
by mytekcontrols
It's the 2nd thing you mentioned: "placing a script in rc.local doesn't always start avahi-daemon successfully"

So I would guess that either the script needs to go elsewhere, or a different approach needs to be taken, such as figure out why a re-start of Avahi is even required after reboot.

You originally posted this tutorial describing enabling AirPrint for your wife's iPad. Has she experienced any problems maintaining a printer discovery after rebooting the Linux machine?

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sun Jan 09, 2011 1:10 pm
by altair4
You originally posted this tutorial describing enabling AirPrint for your wife's iPad. Has she experienced any problems maintaining a printer discovery after rebooting the Linux machine?
She doesn't use the feature that often to make it a fair test but every time she's needed it it was available. I should point out that avahi has always started by default on my systems so your situation has never happened to me. I have noticed that avahi-daemon not starting on boot seems to be happening with may distros based on my google searches.

At first I thought of just placing your script here: /etc/network/if-up.d
By design anything at that location will only be executed after the network is up but it appears there already is an avahi-daemon script at that location for other reasons. Right now I'm thinking of a modification to the upstart job that starts avahi in the first place but I'm getting way beyond my comfort zone with that.

I'll keep at this but it would help if it was an issue on my system.

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sun Jan 09, 2011 6:57 pm
by mytekcontrols
Hmm... So this sounds like a Linux Mint Avahi implementation problem. I'll do some searches and see what I find out. And of course if I have some success at getting it to work, I'll post the results here, which I also assume you would as well.

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sun Sep 25, 2011 4:11 am
by rfanch3r
I know this is an old post but I am running into an issue with the instructions provided.

python ./airprint-generate.py
File "./airprint-generate.py", line 6
<!DOCTYPE html>
^
SyntaxError: invalid syntax

I have python-cups installs as well and result in the error, anyone else get this error?

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sat Mar 03, 2012 7:14 pm
by wagonlips
Thanks, altair4. This is working! (Linux Mint 11) My avahi-discover seg faults when I try to run it, not sure what that's about. But the important thing is the wife's iPad can see the printer in the office now. Cheers!

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Thu May 10, 2012 1:27 am
by ariberlari
Hi,

Iam newbie on this Linux.
However, I am trying this method using Ubuntu 11.10
So far the steps are followed smoothly until step No.8 gksu gedit /etc/cups/cupsd.conf
i cannot open and edit the cupsd.conf by using terminal.
And if Im using folder explorer bu simply clicking to open, this file won't be saved.
I think any permission problem. :(

so i need your advice on this problem please.
Appreciate your reply.

Many thanks.

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Thu May 10, 2012 4:11 am
by AlbertP
With gksudo gedit /etc/cupsd/cupsd.conf you should be able to edit the file. Indeed, when just browsing to it you don't have permission.

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Thu May 10, 2012 6:10 am
by ariberlari
AlbertP wrote:With gksudo gedit /etc/cupsd/cupsd.conf you should be able to edit the file. Indeed, when just browsing to it you don't have permission.

thanks for your reply.


btw, does anyone has been done this method with Ubuntu 11.10? mine is not working. is that compulsory to use Mint?

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Fri Jun 01, 2012 9:44 pm
by BonjourPrinter
These instructions should not be followed under any circumstances anymore!

Get CUPS server 1.4.6 or higher, then enable network printer sharing and it will automatically announce the proper AirPrint-compatible Bonjour/mDNS (DNS-SD) services.

Remember that enabling printer sharing is a 3-step process:
* Enable the individual printer for sharing.
* Enable CUPS network sharing (this is what actually starts the sharing).
* Ensure that DNS-SD is enabled in CUPS (it is enabled by default).

All steps can be done via the CUPS web interface (http://localhost:631/) or your control panel.

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Fri Jun 01, 2012 11:14 pm
by ariberlari
BonjourPrinter wrote:These instructions should not be followed under any circumstances anymore!

Get CUPS server 1.4.6 or higher, then enable network printer sharing and it will automatically announce the proper AirPrint-compatible Bonjour/mDNS (DNS-SD) services.

Remember that enabling printer sharing is a 3-step process:
* Enable the individual printer for sharing.
* Enable CUPS network sharing (this is what actually starts the sharing).
* Ensure that DNS-SD is enabled in CUPS (it is enabled by default).

All steps can be done via the CUPS web interface (http://localhost:631/) or your control panel.

Hi, thanks for your update on this topic.
Regarding this CUPS server update, so we only need the configuration at CUPS web interface localhost:631

Anyway, would you please show me the step by step how to do that configuration?
What kind of configuration we need to do at this step?

Thank you and appreciate that.

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sat Jun 02, 2012 3:04 am
by BonjourPrinter
Okay, if you need more details about where the settings are, you can read my guide here:

http://forums.linuxmint.com/viewtopic.php?f=42&t=103900

Ignore the beginning dealing with Brother printer driver installation, and read the parts relating to the web interface (localhost:631) and sharing the printer.

I hope you are smart enough to realize what parts talk about Brother printer setup and what is about sharing. Good luck!

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sat Jun 02, 2012 9:56 am
by ariberlari
BonjourPrinter wrote:Okay, if you need more details about where the settings are, you can read my guide here:

http://forums.linuxmint.com/viewtopic.php?f=42&t=103900

Ignore the beginning dealing with Brother printer driver installation, and read the parts relating to the web interface (localhost:631) and sharing the printer.

I hope you are smart enough to realize what parts talk about Brother printer setup and what is about sharing. Good luck!

Thanks again for detail. i will try and get back to you the update :)

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Sat Jun 02, 2012 12:51 pm
by altair4
BonjourPrinter wrote:These instructions should not be followed under any circumstances anymore!
Whoa! That got my attention being all bold and red and all.

As I have discovered in the 18 months since I did this there doesn't seem to be a lot of demand to print from the iPad in this shop so I forgot about it. So to see how things have changed since then I ran under my current circumstances:

** I use Xubuntu 12.04 these days. ( Mint13 equivalent )
** I'm using an iPad3 - or New iPad , or whatever it's called instead of the iPad1 I used then.
** I made no modifications whatsoever to the base configurations of cups or it's printers aside from sharing the printer and ensuring that the cups server allows publishing of those printers. And I certainly did not do anything mentioned in this HowTo.

The iPad discovers the printer(s) just as easily and no doubt using the same avahi discovery mechanism that a Mac would.

So In conclusion you are correct sir or madam and I will amend the original post specifying that this HowTo is no longer necessary or valid and attribute that discovery to you.

Re: Enable iPad AirPrint on a Mint Attached Printer

Posted: Wed Dec 05, 2012 1:45 pm
by ariberlari
altair4 wrote:
BonjourPrinter wrote:These instructions should not be followed under any circumstances anymore!
Whoa! That got my attention being all bold and red and all.

As I have discovered in the 18 months since I did this there doesn't seem to be a lot of demand to print from the iPad in this shop so I forgot about it. So to see how things have changed since then I ran under my current circumstances:

** I use Xubuntu 12.04 these days. ( Mint13 equivalent )
** I'm using an iPad3 - or New iPad , or whatever it's called instead of the iPad1 I used then.
** I made no modifications whatsoever to the base configurations of cups or it's printers aside from sharing the printer and ensuring that the cups server allows publishing of those printers. And I certainly did not do anything mentioned in this HowTo.

The iPad discovers the printer(s) just as easily and no doubt using the same avahi discovery mechanism that a Mac would.

So In conclusion you are correct sir or madam and I will amend the original post specifying that this HowTo is no longer necessary or valid and attribute that discovery to you.



Hi, i hv been trying with mint 12 and ipad 2 (no jailbreak), and resulting the printer is not detected from thre ipad. I managed the cups already and make it share. But have no luck from the ipad. Do you hv any idea what im missing for?