我有 Zebra MZ 220 打印机,我需要通过蓝牙从我的 android 应用程序打印 QR 码。我可以打印文本和图像,但不能打印二维码。
我发现了这个:https ://km.zebra.com/kb/index?page=content&id=SO7133&actp=LIST_POPULAR
所以,这是我的代码:
new Thread(new Runnable() {
public void run() {
try {
// Instantiate connection for given Bluetooth® MAC Address.
ZebraPrinterConnection thePrinterConn = new BluetoothPrinterConnection("XX:XX:XX:XX:XX:XX");
// Initialize
Looper.prepare();
// Open the connection - physical connection is established here.
thePrinterConn.open();
// SO THIS SHOULD PRINT THE QR CODE BUT DOESN'T :(
thePrinterConn.write("! 0 200 200 500 1\r\nB QR 10 100 M 2 U 10\r\nMA,QR code ABC123\r\nENDQR\r\nFORM\r\nPRINT".getBytes());
//Make sure the data got to the printer before closing the connection
Thread.sleep(500);
// Close the connection to release resources.
thePrinterConn.close();
Looper.myLooper().quit();
} catch (Exception e) {
// Handle communications error here
e.printStackTrace();
}
}
}).start();
它不起作用。所以....任何帮助表示赞赏:)