IOS printing via CUPS

Dec 22, '10 07:30:00AM

Contributed by: Anonymous

The recently released iOS 4.2.1 allows Apple iOS devices (iPad, iPhone) to print using a new system called AirPrint. Currently this is only supported by a few select hardware manufacturers. This hint points to an alternative method using open source software, namely the CUPS system (included with Mac OS X) and the Avahi Bonjour services discovery software.

This document outlines how to configure CUPS and Avahi to allow printers to show up on IOS devices and allow printing to them. As a proof of concept cups-pdf was used to create a PDF of the printed document.

The easiest way to install the required software packages is to use a repository like MacPorts or Fink. You'll also need to have the Developer Tools installed to build the packages.

Then create the XML file playprinter.service to describe the printer service and save it in /etc/avahi/services. The contents of that file are given below, based on the format provided in the above linked article.

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
 <name>Play 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/PDF</txt-record>
<txt-record>ty=Play Printer</txt-record>
<txt-record>adminurl=http://printers.00:631/printers/PDF</txt-record>
<txt-record>note=Super Space</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>
There is also another handy and informative article which offers a method (using a python script) to automatically create the service description file for Avahi.

[crarko adds: I haven't tested this one. I just bought Printopia when it first came out, but this hint does offer a free solution if you want to do some under the hood tinkering. The method here could also be used to share printers through Linux and possibly Windows with some work.]

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20101027080807322