How can you connect iOS app to a non-Airprint printer? (perhaps using the printer's IP address)

I'm writing an app to print text to a non-Airprint printer. The printer is connected to the internet router and has its own IP address. I would like to be able to connect to the printer from the app, just like how ePrint be able to do so.


Appreciate your help.

How can you connect iOS app to a non-Airprint printer?

That very much depends on your specific requirements. To start, do you care about printing to the printer via iOS’s built-in printing architecture? If so, that’s going to be challenging, because the printing architecture is tightly focused on AirPrint.

If, however, you’re OK with talking to the printer directly, a solution is feasible. It boils down into three parts:

  • Discovering the printer (A)

  • Transporting data to the printer (B)

  • Formatting the data so it actually prints (C)

For a normal printer there’s standard answers to each of these issues:

  • Bonjour (A) [1]

  • IPP, that is, HTTP[S] over TCP (B) [2]

  • AirPrint formats, like PDF (C)

To address A through C with your printer you’ll need to work out what protocols it speaks. For an example of this, let’s consider the first point, printer discovery (A). If the printer advertises via Bonjour then you can find it with

NSNetService
. If it doesn’t then you’ll have to implement whatever non-standard discovery protocol it uses. Or if doesn’t have such a protocol, or there’s technical reasons you can’t implement that protocol, you can have the user hard-code an IP address.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

[1] Specifically:

[2] With link-local support via another Bonjour technology:

RFC 3927 Dynamic Configuration of IPv4 Link-Local Addresses

How can you connect iOS app to a non-Airprint printer? (perhaps using the printer's IP address)
 
 
Q