We are going to develop an app that prints invoice from Bluetooth printer. But we have to send TSPL commands like;
String bytes =
"SIZE 3,2"
"DIRECTION 1,0"
"GAP 0,0\n"
"REFERENCE 0,0"
"OFFSET 0mm"
"SET PEEL OFF"
"SET CUTTER OFF"
"SET PARTIAL_CUTTER OFF"
"SET TEAR ON"
"CLS"
"TEXT 10,100, \"ROMAN.TTF\",0,1,1,\" MALINCINSI \""
"TEXT 10,120, \"ROMAN.TTF\",0,1,1,\" MALINCINSI \""
"TEXT 10,150, \"ROMAN.TTF\",0,1,1,\" KDV: %18 \""
"TEXT 10,200, \"ROMAN.TTF\",0,3,2,\" 12.79 \""
"BARCODE 328,386,\"128M\",102,0,180,3,6,\"!10512345678\""
"TEXT 328, 250, \"ROMAN.TTF\",0,1,1,\"12345678\""
"PRINT 1,1"
;
I have used bluetooth_thermal_printer: ^0.0.6 and esc_pos_utils and I have sent that commands like this;
final result = await BluetoothThermalPrinter.writeText(bytes);
but bluetooth printer never print this commands in TSPL mode.
According to debug console result says true. But printer not printing anything. Is there any way or package to send and print TSPL commands from bluetooth printer.
Luckily, I'm working on thermal printers nowadays and I have seen this question while looking for answers for my own questions. I'm using
flutter_blue_plusandesc_pos_utilslibraries. I'll share a code piece to help you send TSPL commands to thermal printer over Bluetooth connection.To explain what I wrote:
connectedDevicevariable is the device I have connected before executing this function.Finally, I suggest you to search for "THERMAL BARCODE PRINTER Programming Manual" in Google to create your own TSPL codes for different scenarios.