我正在尝试在热敏打印机中打印图像。 android端没有问题,但是ios端打印过程不完整。它只打印图像的一半。
软件包:print_bluetooth_ Thermal、esc_pos_utils_plus、widgets_to_image
final Uint8List? imageBytes = await controller.capture(pixelRatio: 1);
final profile = await CapabilityProfile.load();
final generator = Generator(PaperSize.mm58, profile);
List<int> bytes = [];
bytes += generator.reset();
var image = img.decodeImage(imageBytes);
if (Platform.isIOS) {
final resizedImage = img.copyResize(image!, width: image.width ~/ 1.3, height: image.height ~/ 1.3, interpolation: img.Interpolation.nearest);
final byteString = Uint8List.fromList(img.encodeJpg(resizedImage));
image = img.decodeImage(byteString);
bytes += generator.imageRaster(image!,align: PosAlign.center);
}else{
bytes +=generator.imageRaster(image!);
}
bytes += generator.feed(2);
var printing = await PrintBluetoothThermal.writeBytes(bytes);
print(printing); // donot show any message
我也遇到了同样的问题,但还没解决。您对此有任何更新吗?