Search code examples
iosairprintthermal-printerraw-data

AirPrint on iOS: how to send RAW data to a Boca printer?


I'm writing an iOS application which needs to print using a Boca thermal printer. They use a proprietary language (FGL) to layout contents with commands in form of ASCII strings. I already enabled AirPrint for the Boca printer by using the AirPrint activator tool which can be downloaded for free.

My problem is that using UIPrintInteractionController, all I can do is send either already formatted text (the BOCA will then not recognize the FGL commands, printing them as if they were normal text) or NSData which needs to have a PDF header (which my data doesn't have, so I can't print this way).

Is there any way to bypass this framework and send raw ASCII data to the printer? Should I be using NSStreams and manage the print job in a low level way?

In that case, is there any way to obtain the printer's address on the network so I can establish a socket connection to it?


Solution

  • It sounds as though you need either a 3rd Party library or write one yourself

    But I'm not sure about the internals of networked printers function, but I were you I would ask myself:

    • Does the printer broadcast it's IP Address to the network?
    • If not what functionality does it supply to make it self discoverable to other devices?
    • Does the printer respond to a specific broadcast message from the device wanting to connect to it?
    • Does it solely rely on UDP or TCP packets?

    If you can get in contact with their customer service you may be able to get hold of this information if it isn't documented on the net.

    Sorry i can't give you a direct answer, but hopefully these questions help you find the answer