AirPrint on MyBook Live
These instructions will allow you to print from your iPhone or iPad (on IOS 4.2) to a printer setup on your network. I have done this for MyBook Live but I guess it could be done for the whitelight (the difference is lack of avahi). Obviously this will work easily for whitelights on Debian (MyBook Live is Debian).
1. You need CUPS to be working so that you can print to a network printer.
2. CUPS ghostscript must be working so that PDFs and text files can be printed (there are no print drivers on the iPad so MyBook Live does this)
3. Add a file to /etc/avahi/services so that the Bonjour service can broadcast the CUPs printer
NB below I use 192.168.0.10 as the ip of mybook Live, and 192.168.0.1 as my router with my USB (non-postscript) laser printer connected
I did this over several days and regrettably did not keep a record of everything I did. Hopefully someone doing a fresh install could write a better guide. So, I apologize now for the vagueness of these instructions, but I did at least include all the web pages I used as referemce.
You will need to install several packages. Do the following:
"aptitude install cups ghostscript foo2zjs python-cups cups-driver-gutenprint"
FYI: foo2zjs is a package that lets you select many non-postscript printers (I have a Samsung CLP-315 colour laser) - remove this from list if you have only PS printer
FYI: python-cups is a package which loads the cups modules for python. We need this for a very time saving python scipt we run later called airprint-generate.py written by tjfontaine.
Here is the output of “dpkg —get-selections | grep cups”
1. Edit /etc/cups/ cupsd.conf and do the following:
- Add “ServerAlias *” somewhere in the file near the start
- Add “Allow @LOCAL” within each “Location” block. I have three in my file.
- Allow remote administration…
2. Restart cups: /etc/init.d/cups restart
3. Open browser : https://192.168.0.10:631, add your printer using the CUPS interface
a. As you cannot hang one directly to the box, I point to my printer which is attached to my router via USB cable
b. The interface in this case would be lpd://192.168.0.1/p1
(my draytek router is located at 192.168.0.1 and its queue is p1 – other routers will differ)
4. Test the printer by printing a textfile from the command line: lp –d <printer-name> mytextfile
Do not continue until you get this working. The rest is quite easy.
TO get the Cups printer to Broadcast its availability on the Bonjour service:
1. Get the python script that will save us a lot of time from here: https://github.com/tjfontaine/airprint-generate
a. What we are about to do is explained here: http://www.finnie.org/2010/11/13/airprint-and-linux/
b. What and why the above was automated in the python script is explained here: http://www.atxconsulting.com/blog/tjfontaine/2010/11/21/automatically-generate-airprint-avahi-service-files-cups-printers
2. Decompress and untar the python script somewhere accessible. I put temporarily put mine in /etc/avahi/services
3. I ran the script without any options: ./airprint-generate.py
a. If you get “error: ImportError: No module named cups” then you did not succeed in installing python-cups. You can always manually build the services files using the links to information above.
4. You should have in the same directory that you ran ./airprint-generate.py a “.service” for each printer setup in cups. Make sure these are moved to /etc/avahi/services
5. Apparently, we should not need to restart avahi, but I did: /etc/init.d/avahi-daemon restart
6. Go to your iPhone or iPad running IOS 4.2, open safari, try to print to your printers.
At the moment, IOS will try to print pages as PDFs, and cups will convert them to a format which can be printed. The article above (http://www.finnie.org/2010/11/13/airprint-and-linux/ talks about a URF format (some apple raster format) which at the moment appears optional. That might change in the future and require us to have a urf2pdf converter. That has been done for MacOS here: http://forums.appleinsider.com/showthread.php?t=114679
It could be compiled for the MyBook but I am not going to play with this. What I have works fine for now.