簡體   English   中英

如何從Android應用程序將圖像打印到MZ220打印機?

[英]How to print an image to a MZ220 Printer from Android application?

我有一台Zebra MZ220便攜式藍牙打印機。

目前我能夠通過我的Android應用程序使用以下代碼在打印機上打印文本/字符串...

private static void sendZplOverBluetooth(final String theBtMacAddress, final String Data) {
        new Thread(new Runnable() {
            public void run() {
                try {
                   ZebraPrinterConnection thePrinterConn = new BluetoothPrinterConnection(theBtMacAddress);
                   Looper.prepare();
                   thePrinterConn.open();
                   String zplData = Data;
                   thePrinterConn.write(zplData.getBytes());
                   Thread.sleep(500);
                   thePrinterConn.close();
                   Looper.myLooper().quit();
                } 
                catch (Exception e) {
                   e.printStackTrace();
                }
           }
       }).start();

}

我想知道是否有辦法可以通過我的Android應用程序在打印機上打印圖像,如果是這樣的話怎么樣? 圖像存儲在SD卡上。 任何幫助? 謝謝

就在這里! 查看隨SDK附帶的開發人員演示的開發人員演示

<install_dir>\android\<version>\demos\src\com\zebra\android\devdemo\imageprint\ImagePrintDemo.java

以下是獲取位圖的方法:

BitmapFactory.decodeFile(file.getAbsolutePath())

你可以通過它傳遞給打印機

getGraphicsUtil()。printImage(pathOnPrinter,bitmap,[x],[y])

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM