Recently while working on our iOS app we had to integrate AirPrint feature in the app to let the user print some documents from the app. AirPrint is an Apple technology that lets you print documents from your iOS and MAC devices without requiring any additional software. The printer needs to be AirPrint capable and many latest printers have adopted the technology. A full list can be found here http://support.apple.com/kb/ht4356.
But if you are stuck with a printer which is not AirPrint compatible (check your printer model in the link above to see if it is indeed AirPrint compatible or not), you can still test your app with that printer. Thanks to my teammate for pointing me to this useful software called handyPrint which helps you with exactly this issue.
For testing from an iOS simulator:
1. Your MAC machine needs to be on the same network as your printers.
2. So, before handyPrint, if you go to your iOS app on the simulator and try to search for a printer, it will show you the below message. Even though printers are available on your network, they are not AirPrint compatible.
3. Download and install handyPrint from http://www.netputing.com/applications/handyprint-v5/
4. Open handyPrint. It will show you your network printers. Turn the switch it displays to ON. You will see a green light below with the text ‘Sharing’.
You will notice that this is a trial version of handyPrint valid for just 14 days. You can purchase the full license with a very small donation (as less as 5$).
5. Now go back to your app on the simulator and click on Search Printers. This time it will show up both the printers that are being displayed on handyPrint. Select any printer you like and give a print command and it will all work.
For testing from an iOS device:
1. Make sure handyPrint is installed and your printers are shared as detailed above.
2. On your MAC, click on the wifi option and click on ‘Create Network’.
3. Enter a name for the network and click create.
4. Your MAC will now broadcast the TestPrinting network. On your iOS device, go to Settings->Wifi. You will see ‘TestPrinting’ listed or you can add it from ‘Other’ option. Your iOS device will now be on the TestPrinting network. Connect your MAC to an ethernet cable to make sure that the connection between the MAC and the printer still works.
5. Go to your app on your iOS device and search for printers. The two shared printers will now show up. Select a printer and give the print command and it should work. You can see the job in the print queue on your MAC as well.