We deal with many cut-and-dry projects. Occasionally, however, we’re approached with a concept that’s slightly outside-of-the-box.
Recently, we were asked to develop a point-of-sale application for one client who needed to print sales and credit card authorization slips from an attached network (LAN) printer. This idea was born of the need for a more cost-effective, scalable solution than the generic function that is most similar, found in Apple’s AirPrint.
We jumped on our options.
There are several ways to integrate printers in iOS. AirPrint allows the user to do so without wires and without a need for drivers. However, AirPrint-native printers tend to be rather expensive.
Our second possibility is to integrate a specific brand of printer using its unique software development kit. While cheaper than AirPrint printers, this configuration meant that we’d need to get our hands on specific equipment; it always wasn’t scalable.
Finally, we approached the socket programming option. Printers are connected via network IP, which allows that printer to support text printouts exclusively; no styling or font options, and absolutely no HTML formatting. Not the most appealing of situations but we had additional tricks in our hat.
Establishing a connection with the network printer using port number and IP address, eradicating any need to purchase an AirPrint-compatible printer. Our client was able to use ordinary network printers of his choosing.
Take that, Apple.
Our challenge was creating a function for data communication to each printer in question, in a format consistent with our client’s requirements. We delved in to format this string of text data prior to sending it to each printer, enabling it to communicate with different network printers possessing the same port number, as the application allowed each user to send prints to different printers at the same time using their IP addresses.
It wasn’t a solution that popped out to us immediately but it was the best solution given our clients needs. Sometimes, a little creativity is necessary – even in development.