【问题标题】:Zebra Android SDK printer not printing images with android 11: bluetooth light is flashing but not printingZebra Android SDK 打印机不使用 android 11 打印图像:蓝牙灯闪烁但不打印
【发布时间】:2021-08-16 09:52:58
【问题描述】:

我们有一个 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:对不起我的英语。

【问题讨论】:

    标签: java android bluetooth zebra-printers


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多