Nyx 打印机
Flutter 插件,用于连接到 Nyx 设备打印机,例如 NB55。
安装
使用 pub 安装 Nyx 打印机
flutter pub add nyx_printer
打印图像
import 'package:nyx_printer/nyx_printer.dart';
...
final _nyxPrinterPlugin = NyxPrinter();
Future<void> printImage() async {
final image = await rootBundle.load("images/img.png");
await _nyxPrinterPlugin.printImage(image.buffer.asUint8List());
}
打印文本
Future<void> printText() async {
await _nyxPrinterPlugin.printText(
"Grocery Store",
textFormat: NyxTextFormat(
textSize: 32,
align: NyxAlign.center,
font: NyxFont.monospace,
style: NyxFontStyle.boldItalic,
),
);
}
打印二维码
Future<void> printQrCode() async {
await _nyxPrinterPlugin.printQrCode(
"123456789",
width: 200,
height: 200,
);
}
打印二维码
Future<void> printBarcode() async {
await _nyxPrinterPlugin.printBarcode(
"123456789",
width: 300,
height: 40,
);
}
许可证
MIT 版权所有 (c) 2023 ALADDIN SID AHMED
