sunmi_printer_pro 0.0.2
sunmi_printer_pro: ^0.0.2 copied to clipboard
Support Sunmi Label Version and Null safety. With this package you can connect with Sunmi printers, print text, image, qrcode, barcodes and a custom Esc/Pos if you like.
sunmi_printer_pro #
This is a fork from sunmi_printer and ideal sunmi_printer_pro, but i implemented a lot of other features described below #
Important: #
THIS PACKAGE WILL WORK ONLY IN ANDROID!
Support Sunmi and Null Safety. I build this flutter plugin based on this: Official Sunmi Inner Printer Doc. But not all method from doc was included in this package!
Installation #
flutter pub add sunmi_printer_pro
What this package do #
- ✅ Write some text (with style or not!)
- ✅ Change font size
- ✅ Jump (n) lines
- ✅ Draw a divisor line
- ✅ Bold mode on/off
- ✅ Underline mode on/off
- ✅ Print Qrcodes with custom width and error-level
- ✅ Print image from asset or from web (example show how to print both)
- ✅ Print rows like recepit with custom width and alignment
- ✅ Able to combine with some esc/pos code that you already have!
- ✅ Cut paper - Dedicated method just to cut the line
- ✅ Printer serial no - Get the serial number of the printer
- ✅ Printer version - Get the printer's version
- ✅ Printer paper size - Get the paper size ( 0: 80mm 1: 58mm)
Tested Devices #
sunmi_printer_proSunmiPrinterPro
Sunmi V2 Pro
Sunmi T2 mini
IPos B08
// import packages
import 'package:sunmi_printer_pro/sunmi_printer_pro.dart';
// all method from sunmi printer need to async await
await SunmiPrinterProPro.bindingPrinter(); // must bind the printer first. for more exmaple.. pls refer to example tab.
Example code when use for transaction printing #
await SunmiPrinterPro.startTransactionPrint(true);
// Right align
await SunmiPrinterPro.printText('Align right',sunmiPrintAlign: SunmiPrintAlign.right);
// Left align
await SunmiPrinterPro.printText('Align left',sunmiPrintAlign: SunmiPrintAlign.left);
// Center align
await SunmiPrinterPro.printText('Align center',sunmiPrintAlign: SunmiPrintAlign.center,);
await SunmiPrinterPro.lineWrap(2); // Jump 2 lines
// Set font to very large
await SunmiPrinterPro.printText('Very Large font!',fontSize: 36);
await SunmiPrinterPro.printQRCode('https://github.com/HVLoc/sunmi_printer_pro'); // PRINT A QRCODE
await SunmiPrinterPro.submitTransactionPrint(); // SUBMIT and cut paper
await SunmiPrinterPro.exitTransactionPrint(true); // Close the transaction
List of enum Alignments #
enum SunmiPrintAlign {
left,
center,
right,
}
List of enum Qrcode levels #
enum SunmiQrcodeLevel {
LEVEL_L,
LEVEL_M,
LEVEL_Q,
LEVEL_H,
}
List of enum Barcode types #
enum SunmiBarcodeType {
UPCA,
UPCE,
JAN13,
JAN8,
CODE39,
ITF,
CODABAR,
CODE93,
CODE128,
}
List of enum Text position in barcode #
enum SunmiBarcodeTextPos {
NO_TEXT,
TEXT_ABOVE,
TEXT_UNDER,
BOTH,
}