I’m creating an software utilizing flutter which might print a cost receipt. However i’ve purchased a chinese language ‘transportable mini printer’. mannequin no ‘X5’. This printer isn’t responsing to print knowledge. connection is steady. after calling print methodology consequence returning true however nonetheless paper position ins not shifting. This printer present an software ‘TinyPrint’ within the playstore.utilizing the app it’s working good. and that i can’t discover any sdk for this printer. what am i able to do proper now?
Future printTicket() async {
String? isConnected = await BluetoothThermalPrinter.connectionStatus;
if (isConnected == "true") {
Listing bytes = await getTicket();
// Listing bytes = utf8.encode("Hey, Printer!nnn");
print(bytes);
// ultimate consequence = await BluetoothThermalPrinter.writeBytes(bytes);
ultimate consequence = await BluetoothThermalPrinter.writeText("hiya there");
print("Print $consequence");
} else {
//Hadnle Not Linked Senario
}
}
Future> getTicket() async {
Listing bytes = [];
CapabilityProfile profile = await CapabilityProfile.load();
ultimate generator = Generator(PaperSize.mm58, profile);
bytes += generator.textual content("Demo Store",
types: PosStyles(
align: PosAlign.heart,
top: PosTextSize.size2,
width: PosTextSize.size2,
),
linesAfter: 1);
bytes += generator.textual content(
"18th Important Street, 2nd Part, J. P. Nagar, Bengaluru, Karnataka 560078",
types: PosStyles(align: PosAlign.heart));
bytes += generator.textual content('Tel: +919591708470',
types: PosStyles(align: PosAlign.heart));
bytes += generator.hr();
bytes += generator.row([
PosColumn(
text: 'No',
width: 1,
styles: PosStyles(align: PosAlign.left, bold: true)),
PosColumn(
text: 'Item',
width: 5,
styles: PosStyles(align: PosAlign.left, bold: true)),
PosColumn(
text: 'Price',
width: 2,
styles: PosStyles(align: PosAlign.center, bold: true)),
PosColumn(
text: 'Qty',
width: 2,
styles: PosStyles(align: PosAlign.center, bold: true)),
PosColumn(
text: 'Total',
width: 2,
styles: PosStyles(align: PosAlign.right, bold: true)),
]);
bytes += generator.row([
PosColumn(text: "1", width: 1),
PosColumn(
text: "Tea",
width: 5,
styles: PosStyles(
align: PosAlign.left,
)),
PosColumn(
text: "10",
width: 2,
styles: PosStyles(
align: PosAlign.center,
)),
PosColumn(text: "1", width: 2, styles: PosStyles(align: PosAlign.center)),
PosColumn(text: "10", width: 2, styles: PosStyles(align: PosAlign.right)),
]);
bytes += generator.row([
PosColumn(text: "2", width: 1),
PosColumn(
text: "Sada Dosa",
width: 5,
styles: PosStyles(
align: PosAlign.left,
)),
PosColumn(
text: "30",
width: 2,
styles: PosStyles(
align: PosAlign.center,
)),
PosColumn(text: "1", width: 2, styles: PosStyles(align: PosAlign.center)),
PosColumn(text: "30", width: 2, styles: PosStyles(align: PosAlign.right)),
]);
bytes += generator.row([
PosColumn(text: "3", width: 1),
PosColumn(
text: "Masala Dosa",
width: 5,
styles: PosStyles(
align: PosAlign.left,
)),
PosColumn(
text: "50",
width: 2,
styles: PosStyles(
align: PosAlign.center,
)),
PosColumn(text: "1", width: 2, styles: PosStyles(align: PosAlign.center)),
PosColumn(text: "50", width: 2, styles: PosStyles(align: PosAlign.right)),
]);
bytes += generator.row([
PosColumn(text: "4", width: 1),
PosColumn(
text: "Rova Dosa",
width: 5,
styles: PosStyles(
align: PosAlign.left,
)),
PosColumn(
text: "70",
width: 2,
styles: PosStyles(
align: PosAlign.center,
)),
PosColumn(text: "1", width: 2, styles: PosStyles(align: PosAlign.center)),
PosColumn(text: "70", width: 2, styles: PosStyles(align: PosAlign.right)),
]);
bytes += generator.hr();
bytes += generator.row([
PosColumn(
text: 'TOTAL',
width: 6,
styles: PosStyles(
align: PosAlign.left,
height: PosTextSize.size4,
width: PosTextSize.size4,
)),
PosColumn(
text: "160",
width: 6,
styles: PosStyles(
align: PosAlign.right,
height: PosTextSize.size4,
width: PosTextSize.size4,
)),
]);
bytes += generator.hr(ch: '=', linesAfter: 1);
// ticket.feed(2);
bytes += generator.textual content('Thanks!',
types: PosStyles(align: PosAlign.heart, daring: true));
bytes += generator.textual content("26-11-2020 15:22:45",
types: PosStyles(align: PosAlign.heart), linesAfter: 1);
bytes += generator.textual content(
'Observe: Items as soon as offered is not going to be taken again or exchanged.',
types: PosStyles(align: PosAlign.heart, daring: false));
bytes += generator.minimize();
return bytes;
}
i’ve used packages :
esc_pos_utils: ^1.1.0
esc_pos_bluetooth: ^0.4.1
flutter_bluetooth_basic: ^0.1.5
bluetooth_thermal_printer: ^0.0.6