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
xWrite some text (with style or not!)xChange font sizexJump (n) linesxDraw a divisor linexBold mode on/offxUnderline mode on/offxPrint Qrcodes with custom width and error-levelxPrint image from asset or from web (example show how to print both)xPrint rows like recepit with custom width and alignmentxAble to combine with some esc/pos code that you already have!xCut paper - Dedicated method just to cut the linexPrinter serial no - Get the serial number of the printerxPrinter version - Get the printer's versionxPrinter 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,
}