Sunmi printer 4.0.0
Package Sunmi printer will support all sunmi devices with different behaviours
Important
THIS PACKAGE WILL WORK ONLY IN ANDROID!
This flutter plugin based Official Sunmi Inner Printer Doc using the latest implementation libs Documentation
You can help me out to keep this package updated!
Installation
flutter pub add sunmi_printer_plus
Should be a bit break change between versions below 4.0
What this package do
x
Write some text (with style or not!)x
Change font sizex
Jump (n) linesx
Draw a divisor linex
Bold mode on/offx
Print all types of Barcodes (see enum below)x
Print Qrcodes with custom width and error-levelx
Print image from asset or from web (example show how to print both)x
Print rows like recepit with custom width and alignmentx
Able to combine with some esc/pos code that you already have!x
Cut paper - Dedicated method just to cut the linex
Printer serial no - Get the serial number of the printerx
Printer version - Get the printer's versionx
Printer paper size - Get the paper size ( 0: 80mm 1: 58mm)x
LCD Print a imagex
LCD Print a stringx
Open de cash drawerx
Check if the cash drawer is open of close
You can run the project cloning the repository below
Repository - then change branch to version-4.0
You can also combine this package with the package esc_pos_utils
With this package you can create a custom escpos and than you don't need to use any other command. This is good if you already have a code that another printers use, and u can reuse this code as well
// import packages
import 'package:sunmi_printer_plus/sunmi_printer_plus.dart';
Example code when use SunmiPrinter
await SunmiPrinter.printText('Simple raw text');
await SunmiPrinter.printText('Bold text centered',
style: SunmiTextStyle(
bold: true,
align: SunmiPrintAlign.CENTER,
));
await SunmiPrinter.lineWrap(2); // Jump 2 lines
await SunmiPrinter.printText('Very Large font!',
style: SunmiTextStyle(
fontSize: 80,
));
await SunmiPrinter.printText('Custom font size!!!',
style: SunmiTextStyle(
fontSize: 32,
));
await SunmiPrinter.printQRCode(
'https://github.com/brasizza/sunmi_printer',
style: SunmiQrcodeStyle(
qrcodeSize: 3,
errorLevel: SunmiQrcodeLevel.LEVEL_H,
)); // PRINT A QRCODE
Example code for LCD functions
await SunmiLcd.configLCD(SunmiLCDStatus)
await SunmiLcd.lcdString('Hello'); //Write a simple line
await SunmiLcd.lcdString('Hello' , 12 , true); //Write a simple line with 12 in size and fill screen
Uint8List byte = await readFileBytes('assets/images/128x40.png');
await SunmiLcd.lcdImage(byte); // Put an image in LCD
Example to open the cashier
bool await SunmiDrawer.i.isDrawerOpen(); //check if the cash drawer is connect or disconnect
await SunmiDrawer.i.openDrawer(); //open de cash drawer
List of enum printer mode
enum PrinterMode {
NORMAL_MODE,
BLACK_LABEL_MODE,
LABEL_MODE
}
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,
}
List of enum Font sizes
enum SunmiFontSize {
XS,
SM,
MD,
LG,
XL,
}
List of enum SunmiLCDStatus
enum SunmiLCDStatus {
INIT,
WAKE,
SLEEP,
CLEAR,
}
Libraries
- core/enums/enums
- core/helpers/sunmi_helper
- core/styles/sunmi_barcode_style
- core/styles/sunmi_qrcode_style
- core/styles/sunmi_text_style
- core/sunmi/sunmi_config
- core/sunmi/sunmi_drawer
- core/sunmi/sunmi_lcd
- core/sunmi/sunmi_printer
- core/types/sunmi_column
- core/types/sunmi_text
- sunmi_printer_plus
- sunmi_printer_plus_method_channel
- sunmi_printer_plus_platform_interface