Star SM-T300i in ESC/POS mode. Firmware 4.4 2021/07/19.
We have 2 issues with printing on the Star thermal printer:
Our Flutter app on Android uses Java code to send text to the printer with ESC/POS commands, followed by a signature image, then more text, then the second signature image, and then the final text with a barcode. Besides centering issues with Star printers (detailed below), this works well.
Here is an example of a printed ticket:
On iOS, we are able to print the ticket on the Star printer using the Objective-C example code from the SDK, as long as we don’t print any images. Here is an example:
No matter what we’ve tried, we can’t seem to find a way to print an image from the Star SDK in Objective-C.
We’ve tried loading the png/jpg image file into an NSData and then using [data bytes] in the writePort command, but no luck.
The issue we are having is with the writePort line from the SDK example:
uint32_t written = [port writePort:command :total : sizeof(command) – total :&error];
How do we load & prepare an image file in Objective-C so that this line will properly output it to the Star printer in ESC/POS mode?
Any assistance you can provide would be greatly appreciated because this project is stopped at this point because we cannot successfully print the signature images.
Here is a normal ticket from our Flutter app running on Android (printed on a NETUM 3″ printer).
This is what it looks like with various thermal printers we have tested (except for Star printers). The signature images and the barcode are properly centered with the standard ESC/POS center sequence:
This is the same ticket printed on the Star printer. Note that we changed the driver and agent titles to be left-justified with Star printers since the images would not center.
How can we get the images and barcode to center on Star printers in ESC/POS mode?
Thanks for your help!