Zebra Android SDK打印机不使用Android 11打印图像:蓝牙灯闪烁但不打印



我们有一个android应用程序,可以使用android sdk for zebra(ZSDK_android_API.jar(打印图像。打印机为ZQ320型号,处于ZPL_HYBRID模式。在某些设备中使用相同打印机的相同应用程序不起作用:蓝牙灯闪烁,但它停止闪烁,最终没有打印任何内容,而在其他设备中打印正常。我们正在尝试找出是否抛出了任何异常,但据我们所知,似乎没有异常在所有代码中抛出。

public static void printBitmapZebra(ZebraPrinter printer, Bitmap path) throws ConnectionException {
String setSizeCommand = "^XA^LL" + path.getHeight() + "^XZ";

printer.sendCommand(setSizeCommand);
ZebraImageAndroid oZebraImage = new ZebraImageAndroid(path);
printer.printImage(
oZebraImage, 0, 0,
path.getWidth(),
path.getHeight(), false);
}

这个代码是从这个调用的:

public void onClickPrint(View view) {
new Thread(() -> {
Connection connection = null;
try {
String mac = macAddress.getText().toString();
if (isNullOrEmpty(mac)) {
runOnUiThread(() -> UIHelper.showCustomToast(
this,
"Debe de especificar una dirección para la impresora."));
return;
}
showModalLoadingDialog("Impresión", "Generando imagen");
Bitmap bm = BitmapUtils.getBitmapFromWebview(oWebViewBmpGenerator);
BitmapUtils.saveBitmapToTempFolder(this,bm);
bm = BitmapUtils.toGrayScale(bm);
bm = BitmapUtils.getScaledPrinterBitmap(bm, 203); // 203 -> ZEBRA ZQ320
if (bm == null) {
throw new Exception("No se generó una imagen para imprimir.");
}
updateLoadingDialog( "Conectando con la impresora");
SettingsHelper.saveBluetoothAddress(PrintZebraActivity.this, mac);
connection = new BluetoothConnection(macAddress.getText().toString());
connection.open();
ZebraPrintUtils.setStatus(connection);
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
updateLoadingDialog("Enviando imagen");
ZebraPrintUtils.printBitmapZebra(printer, bm);
connection.close();
connection = null;
} catch (Exception e) {
cclsLog.log(this, e);
UIHelper.showWarning(this, e);
} finally {
dismissModalProgressDialog();
if (connection != null) {
try {
connection.close();
} catch (Exception ignored) {
}
}
}
}).start();
}

这里有人知道如何解决这个问题吗?提前谢谢。

PD:对不起我的英语。

将打印机(ZQ320(固件更新到最新版本V81.20.22Z.zpl后(https://www.zebra.com/es/es/support-downloads/printers/mobile/zq320.html#pageandfilelist_ac9a)问题已经解决。

最新更新