1
votes

For non-AirPrint enabled printer Apple does not have any in built API. I learned that we can add a WiFi module to a printer. So my question is:

  • If I add WiFi module to a printer, will it be AirPrint-enabled?
  • If not: can a non-AirPrint-enabled printer be made AirPrint-enabled by other means?
  • If I get a non-AirPrint-enabled printer is it possible to connect to it from an iPad?
  • If yes what is the protocol I should use?
  • Is there any open source library on this?

I found the following one: https://github.com/opentable/star-printing.

But from the documentation I could not understand: is it only for AirPrint enabled printers?

Below are the ways I can connect a desktop printer using iPad I guess.

  1. WIFI enabled
  2. Bluetooth enabled
  3. Bonjour enabled printer
  4. Networked printers (printer having same ip segment with iPad)
2

2 Answers

0
votes

Trying to answer all your questions:

  • If I add a wifi module, will my printer be AirPrint enabled?
  • Can a non-AirPrint printer be made into an AirPrint printer?

No. You need an AirPrint compatible printer, simply making it available over WiFi does not make it an AirPrint printer, and you cannot change the device to make it an AirPrint printer.

  • If not, can I still use it?

Yes. However, it will require that you directly open connection with the printer (via a socket) and send the data that way. It's really not too hard to do. There are likely some libraries available, but I haven't specifically tried. The code to open the port and send a data blob is pretty trivial, assuming you have the PCL data already.

  • Can I connect to a WiFi printer?

Yes, as described above.

  • ... Bluetooth?

Yes, but only on MFi (Made For iOS) printers.

  • ... Bonjour

Yes, via the built in print dialog.

  • ... Networked

This could probably be done the same way as the WiFi printing, but I haven't tried it yet.

Hope that helps, let me know if I can clarify anything.

-3
votes

Assuming,...

  • you have a Mac(Book) running OS X,
  • this Mac's hostname is mymac,
  • its IP address is 192.168.111.111,
  • it has a shared printer installed named abcd (does NOT need to be AirPrint-capable!), and
  • the printer share requires no authentication (put DefaultAuthType none into /etc/cups/cupsd.conf),

...then you can make your computer act as an AirPrint gateway to the abcd queue available to iOS clients.

To test this, just execute the following command in a Terminal.app window (attention, the command will not return -- if you close the Terminal.app window, the effect of the command will be gone!)

 dns-sd                 \
   -P AirPrint-abcd     \
   _ipp._tcp,_universal \
   local.               \
   631                  \
   mymac.local.         \
   192.168.111.111      \
         pdl="application/pdf,image/urf"    \
         kind="document"                    \
         priority="1"                       \
         product="Model Name of my Printer" \
         rp="printers/abcd"                 \
         URF="DM3"                          \
         Duplex="T"                         \
         Color="T"                          \
         note="Testing AirPrint via MacBook"\
         txtvers="1"                        \
         qtotal="1"                         \
         printer-type="0x0480FFFC"          \
         printer-state="3"                  \
         air="none"                         \
         UUID="54321abc-1234-1234-abcd-1238e4bdcbf8"

You could come up with a script or cron job which executes this command in the background every time the Mac is booted up. This is left as an exercise to the reader.

Additionally, you could run this same command unchanged from a second, completely different Mac on the same network, if the first Mac is providing the shared print queue and all the details above match the first Mac's settings.


Background info:

The dns-sd command line utility is meant as a testing and development tool for everybody poking into Bonjour, mDNS (multicast DNS) and DNS-SD (DNS-based Service Discovery).

The -P parameter to dns-sd will make a Bonjour "proxy announcement" to your local LAN/WLAN. The announcement will tell potential AirPrint clients the following info:

  • There is an AirPrint device available in your .local. domain.
  • Its name is Airprint-abcd.
  • It can be reached via IP address 192.168.111.111 and port 631.
  • Use the print queue name of printers/abcd to print to it.
  • It can consume PDF and URF raster documents.
  • It does not need authentication.
  • It can output duplex and color documents.

For details about this utility see man dns-sd. For more background, see dns-sd.org and my other answers on similar questions.