TSC Barcode Printer in Android
Usually every order made from POS system, need to print out the labels, so the shop can stick them on the meal or beverage, for them to deliver to the customers easily. TSC Barcode Printer is playing the important role helping on this.
Before writing any code, need to make sure what hardware module the TSC Printer you have. From there website, there are two model, one is basic only support ethernet, the other can support bluetooth model, but also need to plug on an adapter from USB to bluetooth. Mine is the TDP-225 basic one, so only can connect with ethernet.
To setup the TSC printer, make sure the power plugin and has turn on, and has put the printer paper roll inside in correct position.
There is TSC’s Diagnostic Tool can install on Window and adjust the printer setting properly.
You can download Android SDK on TSC download page, make sure put the tscsdk.jar in libs folder, and refresh the Android Studio.
During the print and test, it’s not easy to print at the position you want, so I design a TSCSetup object, let it setup width, height, and all position. And follow the demo code:
- Open Port.
- Clear buffer.
- Send the command.
- Print Label.
- Close Port.
Here is the log print in logcat for a single label:
I sticked them on the paper, the right hand side is the template, and the left one are print from Android App.