Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

IOS printing via CUPS iOS devices
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.]
    •    
  • Currently 3.33 / 5
  You rated: 3 / 5 (6 votes cast)
 
[33,415 views]  

IOS printing via CUPS | 11 comments | Create New Account
Click here to return to the 'IOS printing via CUPS' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
IOS printing via CUPS
Authored by: designr on Dec 22, '10 10:21:42AM

Or... just copy AirPrint Activator < http://netputing.com/airprintactivator > to your Mac and turn it on.



[ Reply to This | # ]
IOS printing via CUPS
Authored by: BMarsh on Dec 22, '10 10:42:37AM

just adding the note that AirPrint Activator only modifies one thing in CUPS to enable Airprinting

"It will only inject a single line in a CUPS configuration when you select to “activate” AirPrint."

it is "donationware".

Makes it a little nicer/easier than everything involved in this hint. Although this hint may allow more features/options.



[ Reply to This | # ]
IOS printing via CUPS
Authored by: fracai on Dec 22, '10 04:23:57PM
It appears that AirPrint Activator only needs to add a single line to one file.

Add image/urf urf string(0,UNIRAST) to /usr/share/cups/mime/apple.types and you should be able to remove, add, and share the printers you want to show up in AirPrint.

I haven't tested this yet, but I intend to.
---
i am jack's amusing sig file


[ Reply to This | # ]
IOS printing via CUPS
Authored by: fracai on Dec 22, '10 05:28:11PM
Better instructions

I've tested this now and it worked. No reboot required, just remove, add, share, done.
---
i am jack's amusing sig file
Edited on Dec 22, '10 05:53:13PM by fracai


[ Reply to This | # ]
IOS printing via CUPS
Authored by: jceaser on Mar 18, '11 06:46:19PM

Apparently the following is now being added by AirPrintActivator:

image/urf urf string(0,UNIRAST<00>)



[ Reply to This | # ]
IOS printing via CUPS
Authored by: magnamous on Nov 19, '13 05:07:48PM
In OS X 10.9, I have the following line in the file by default (I didn't add it):

image/urf urf string(0,UNIRAST)

But I can't seem to see printers on iOS...

Edited on Nov 19, '13 05:08:43PM by magnamous


[ Reply to This | # ]
IOS printing via CUPS
Authored by: edwardp on Dec 22, '10 11:00:27AM
I use another way.

This page gives a solution using the command line tool dns-sd http://www.dslreports.com/forum/r25119888-AirPrint-enable-your-printer-via-simple-command-line-hack

With http://www.tildesoft.com I got it to work with this command line

dns-sd -R "My Printer" _ipp._tcp.,_universal . 631 txtver=1 qtotal=1 rp=printers/Samsung_ML_2010 ty="ML-2010" adminurl=none note=mememini product="(CUPS v1.1)" printer-state=3 printer-type=0x9006 Transparent=T Binary=T pdl=application/pdf,application/postscript,application/vnd.cups-raster,application/octet-stream,image/png URF=none

Cheers! Edward

[ Reply to This | # ]
IOS printing via CUPS
Authored by: grueni on Dec 23, '10 03:57:51PM

funny I came across a german programmers blog
http://www.lisanet.de/?p=71#comment-179
she even created an applescript that should do the trick here (4 free)
http://www.lisanet.de/blog/wp-content/uploads/2010/11/AirPrint-On.zip

the core bit is (my translation) :

to enable airprint one only needs to create a single file (named airprint.types) with a single line of text and save it into the directory /usr/share/cups/mime. No need to alter systemfiles, which is quite nice. The contents of the file should be

image/urf urf (0,UNIRAST)

original german:

Um AirPrint freizuschalten muss nur eine Datei mit einer Zeile Text erzeugt werden und in das Verzeichnis /usr/share/cups/mime abgespeichert werden. Dabei werden keinerlei Systemdateien verändert, was schon mal recht positiv ist. Die Zeile lautet:

image/urf urf (0,UNIRAST)

I'm too lazy to translate all her explanations :-) basically the file seems to signal cups that airprint can also use a filetype named urf, which seems to be what Ios devices do. I am no real programmer but it worked for me.

Jo

all credit goes to Simone who found it and published it ...

PS.: of course the printer needs to be connected to your mac (the one where you added the file) and should be on (tp print) also printer sharing needs to be enabled for that printer and the mac must be somehow WLAN wise in touch with your iphone / ipad... (on the same WLAN I guess) - J

Edited on Dec 23, '10 04:06:54PM by grueni



[ Reply to This | # ]
IOS printing via CUPS
Authored by: tobylane on Dec 26, '10 03:10:19PM

Does any of this allow for virtual printers (google results on it seem to be about early Leopard at the latest) like Printopia?

The linked post is aimed at linux, mac already has it all. It doesn't immediately seem transferable (as in using what we already have).

Edited on Dec 26, '10 03:22:59PM by tobylane



[ Reply to This | # ]
IOS printing via CUPS
Authored by: grueni on Dec 27, '10 05:31:16AM

@ tobylane
the lisanet hint should work with any printer that you are able to share. It works with a brother MFC-7820N and a Canon i9950 here.

the hint is very simple, im merely creates a additional file format which seems to be the trick that Apple uses to print from IOS devices. Nothing else. As it is not a software like Printopia it has no "additional" features.

So if you have a virtual printer set up on your Mac and you are able to share it it should work. I have no virtual printers set up so I can't test it.

J



[ Reply to This | # ]
IOS printing via CUPS
Authored by: Hairball1975 on Aug 12, '14 09:01:12AM

With useful info found on this page and others, I've been working on getting all local printers shared to AirPrint automatically and updating this.

I've put my initial work on GitHub but could use some scripting help with the final "for in do" command which it not coming out quite right.

I know there is papercut, AirPrint Activator and others however, I'd like to have an open source (Apple) solution.

https://github.com/Macdeviant/iOS-AirPrint-for-Mac


Craig



[ Reply to This | # ]