3

ZebraMZ220ポータブルBluetoothプリンターを持っています。

現在、次のコードを使用して、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カードに保存されます。何か助けはありますか?ありがとう

4

1 に答える 1

3

はいあります!SDKに付属の開発者デモに付属の開発者デモを確認してください

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

ビットマップを取得する方法は次のとおりです。

BitmapFactory.decodeFile(file.getAbsolutePath())

それを経由してプリンタに渡すことができます

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

于 2011-03-09T17:13:55.353 に答える