【问题标题】:Zebra EM 220, print image using AndroidZebra EM 220,使用 Android 打印图像
【发布时间】:2013-03-20 14:50:40
【问题描述】:

我想用 Zebra EM220 从我的 SD 卡打印一张图像。我试着用 GraphicsUtil.printImage("image path", 0, 0) 但我所有的尝试都失败了,我只能打印一个字符列表。

我第一次尝试使用它:

ZebraPrinter zp = ZebraPrinterFactory.getInstance(printerCo);
zp.getGraphicsUtil().printImage(path, 0, 0);

但结果是 ZebraLanguageUnknownException。
所以我遵循了这个解决方案:https://km.zebra.com/kb/index?page=content&id=SO8239&actp=LIST_RECENT 但只打印了一个字符列表。

我不知道如何解决这个问题,所以如果有人成功地使用 Zebra EM 220 打印了图像并且可以共享代码,它应该会对我有所帮助。

我的代码:

public void print(){
    String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/myimage.jpg";
    ZebraPrinterConnection printerCo = new BluetoothPrinterConnection(printerMacAdress);
    try {
        printerCo.open();
        if (printerCo.isConnected()){
            ZebraPrinter zp = new ZebraPrinterCpcl(printerCo);
            zp.getGraphicsUtil().printImage(path, 0, 0);
            Thread.sleep(500);
        }               
    } catch (ZebraPrinterConnectionException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } finally {
        try{
            // Close the connection to release resources.
            printerCo.close();
        } catch (ZebraPrinterConnectionException e) {
            e.printStackTrace();
        }
    }
}

}

【问题讨论】:

    标签: android printing zebra-printers


    【解决方案1】:

    您是否使用 ZebraLink SDK?如果是这样,它不支持 EM220。 ZebraLink SDK 设计用于 CPCL 和 ZPL 打印机。您可以在此处查看支持的打印机列表:(单击中间的兼容打印机链接):http://www.zebra.com/us/en/products-services/software/adapt-software/zebralink-sdk-android.html#mainpartabscontainer_71ac=downloads

    对于 EM 220,您应该改用 Zebra 的 EM 220 SDK for Android(底部链接):http://www.zebra.com/us/en/support-downloads/mobile/em-220.html

    这里有一段示例代码(来自 Zebra 的知识库),解释了通过此 SDK 打印到 EM 220 的一种方法:https://km.zebra.com/kb/index?page=answeropen&type=open&searchid=1363808738897&answerid=16777216&iqaction=5&url=https%3A%2F%2Fkm.zebra.com%2Fkb%2Findex%3Fpage%3Dcontent%26id%3DSA316%26actp%3Dsearch%26viewlocale%3Den_US&highlightinfo=4194576,157,181#

    【讨论】:

    • 确实,我使用的是 ZebraLink SDK。感谢您的回答,现在可以正常使用了。
    猜你喜欢
    • 2013-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-16
    • 2021-08-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多