我想将条形码打印到我的zebra蓝牙打印机上,但是我唯一的建议是使用图像打印条形码,但是打印机发出哔哔声无法打印任何内容。
String pathImage;
initSavetoPath()async{
//read and write
//image max 300px X 300px
final filename = 'yourlogo.png';
var bytes = await rootBundle.load("assets/images/yourlogo.png");
String dir = (await getApplicationDocumentsDirectory()).path;
writeToFile(bytes,'$dir/$filename');
setState(() {
pathImage='$dir/$filename';
sample(pathImage);
});
}
//triggerd on button pressed
sample(String pathImage) async {
bluetooth.isConnected.then((isConnected) {
if (isConnected) {
bluetooth.printNewLine();
bluetooth.printCustom("barcode Sample",3,0);
bluetooth.printNewLine();
bluetooth.printImage(pathImage);
});
}