Wednesday, 7 April 2010

iPhone Printing using MonoTouch - Proof of concept

Printing from the iPhone (also iPad I presume) it's not an impossible task (as it is in WP7 for the moment). It can be done using a network printer connected to the device using wireless radio (infrastructure or Ad hoc mode). As there is no internal driver for printing developers will have to write an interface to the printer. The "task" is pretty big as there are many programming languages for printers: HP PCL5, Epson ESC/P, PostScript, Zebra Programming Language, ASCII printers and many more. Using socket programing available in MonoTouch it is possible to communicate/print to any network printer, but it would be easier to have a "unified" interface like the ones available on WinCE (PrinterCE, PrintCE), libraries that can be
ported to the iPhone.
The attached sample it's not simple line printing but implements a small part of the PCL5 interface. It will print two boxes and some text on any PCL5 compatible network printer (if you have such a printer you can try it). The only two parameters required are the IP of the printer and the port used for communication (usually 9100).
Let's hope that soon we will see PrinterTouch or PrintTouch library :). If you need more details or find this post useful please let me know.

I will continue my "quest" for developing a small S.F.A. application on the iPhone and/or iPad using MonoTouch.


SocketPrint

0 comments:

Post a Comment