简体   繁体   English

Zebra EM 220,使用Android打印图像

[英]Zebra EM 220, print image using Android

I'd like to print an image from my sd card with a Zebra EM220. 我想用我的SD卡用Zebra EM220打印图像。 I tried to use GraphicsUtil.printImage("image path", 0, 0) but all my attempts failed and I'm just able to print a list of characters. 我试图使用GraphicsUtil.printImage("image path", 0, 0)但我的所有尝试都失败了,我只能打印一个字符列表。

In a first time, I tried to use that : 我第一次尝试使用它:

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

But the result was a ZebraLanguageUnknownException. 但结果是ZebraLanguageUnknownException。
So I followed this solution : https://km.zebra.com/kb/index?page=content&id=SO8239&actp=LIST_RECENT but just a list of characters was printed. 所以我遵循了这个解决方案: https//km.zebra.com/kb/index?page = content&id = SO8239&actp = LIST_RECENT,但只打印了一个字符列表。

I have no idea how to solve the problem so if someone succeeded to print an image with the Zebra EM 220 and can share the code, it should help me. 我不知道如何解决这个问题,所以如果有人成功用Zebra EM 220打印图像并且可以共享代码,它应该对我有所帮助。

My code : 我的代码:

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();
        }
    }
}

} }

Are you using the ZebraLink SDK? 您使用的是ZebraLink SDK吗? If so, it does not support the EM220. 如果是这样,它不支持EM220。 The ZebraLink SDK is designed for use with CPCL and ZPL printers. ZebraLink SDK设计用于CPCL和ZPL打印机。 You can see the list of supported printers here: (click the compatible printers link in the middle): http://www.zebra.com/us/en/products-services/software/adapt-software/zebralink-sdk-android.html#mainpartabscontainer_71ac=downloads . 您可以在此处查看支持的打印机列表:(单击中间的兼容打印机链接): http//www.zebra.com/us/en/products-services/software/adapt-software/zebralink-sdk-android .html #mainpartabscontainer_71ac =下载

For the EM 220, you should instead use Zebra's EM 220 SDK for Android (bottom link): http://www.zebra.com/us/en/support-downloads/mobile/em-220.html . 对于EM 220,您应该使用Zebra的EM 220 SDK for Android(底部链接): http//www.zebra.com/us/en/support-downloads/mobile/em-220.html

And here is a quick piece of sample code (from Zebra's knowledgebase) explaining one method of printing through this SDK to an 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# . 这里有一段快速的示例代码(来自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#

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM