Last updated:
0 purchases
flutter sunmi printer plus
flutter_sunmi_printer_plus #
This is plugin inspired by SunmiPrinterDemo
Platform Support #
This plugin works only on android
Usage #
To use this plugin, add flutter_sunmi_printer_plus as a dependency in your pubspec.yaml file
What this package do #
✅ Print text with style (font size,bold or not,alignment,..)
✅ Print image (you can set alignment)
✅ Print table
✅ Print qrcode (with stye)
✅ Print barcode(with style)
✅ Jump n-lines
✅ Cut paper
Example #
Import the library.
import 'package:flutter_sunmi_printer_plus/flutter_sunmi_printer_plus.dart';
copied to clipboard
Then invoke the static initPrinter method to initiate sunmi printer .
@override
void initState() {
super.initState();
Future.delayed(Duration.zero, () async {
try {
isConnected = await SunmiPrinter.initPrinter() ?? false;
setState(() {});
} catch (err) {
errorMessage = err.toString();
}
setState(() {});
});
}
copied to clipboard
Print text
await SunmiPrinter.printText(
content: "Test String",
style: SunmiStyle(
fontSize: 20,
isUnderLine: true,
bold: false,
align: SunmiPrintAlign.LEFT));
copied to clipboard
Print image
await SunmiPrinter.printImage(image: bytes, align: SunmiPrintAlign.CENTER); // bytes as Uint8List
copied to clipboard
Print table
await SunmiPrinter.printTable(cols: [
ColumnMaker(text:"test#1" ,align:SunmiPrintAlign.LEFT ,width:5),
ColumnMaker(text:"test#2" ,align:SunmiPrintAlign.LEFT ,width: 5),
]);
copied to clipboard
Print barcode
await SunmiPrinter.printBarCode(data: "1234567890",height: 50,width: 2,textPosition: SunmiBarcodeTextPos.TEXT_UNDER,barcodeType:SunmiBarcodeType.CODE128,align:SunmiPrintAlign.CENTER );
copied to clipboard
Print qrcode
await SunmiPrinter.printQr(data: "https://twitter.com/wojoodtech",align:SunmiPrintAlign.CENTER,size: 5);
copied to clipboard
See the main.dart in the example for a complete example.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.