Converting Image to Send to Bluetooth Low Energy Printer on IOS

Hi guys,

 

In our use-case, we want to support users being able to use Zebra printers through our IOS application connecting via Bluetooth Low Energy.  When we go to print, the label that we print may contain a logo (that we want to pre-load onto the printer).

 

Looking at the Zebra SDK, I see the ability to storeImage() onto a printer.  However, as I understand it, this SDK does not support BLE, as it does not have a connection that interacts with CoreBluetooth at all.

 

I have already implemented the logic to send the label to the printer using BLE service/characteristics, etc.  This works perfectly (as long as I stay under the 512 byte limit).  I know there is a ZPL command to store an image (specifically ^DG), and have some familiarity with the way it works.  My problem right now, is trying to implement the logic to go from UIImage (or CGImage) to the correct hex string that the printer will support, so that it can be recalled later onto the labels we want to print.

 

To add to this complexity, these cannot be pre-converted and added statically at build time, because they are dictated by the user of our application.

 

Any help would be greatly appreciated!

Christal Spaeth
Andrew, In this case, the

Andrew,

In this case, the easiest way to do this is to convert the image to a bitmap/png in base64 format and downloading it using the Download Object command (~DY). The base64EncodedStringWithOptions method will return a base64 encoded string. The ~DY command also handles these image formats better than the ~DG command. The ZPL Manual gives a more in depth explanation on base64 encoding.

Christal

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Manuel Caicedo-...
Andrew,BLE communication

Andrew,

BLE communication allows the transmission of very small packages of data. Any graphic sent through BLE could take up to a minute or more depending on the graphic's size. We do not recommend sending graphics through BLE. BLE is recommended only to send small pieces of data as labels/receipts by using ZPL/CPCL commands, or to recall ZPL templates with pre-loaded graphics in the printer.

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments