image - Printing to Zebra QLn320 from Android -
i trying print image saved on android device on bt enabled zebra printer , i've followed examples documentation, can't life of me figure out why it's not printing. bt icon flashes on printer while know connection being made, nothing happens. when call printimage() function giving location of image , desired width , height. know file exists because can see displayed in imageview. here code:
private void printimagetest() { new thread(new runnable() { @override public void run() { try { looper.prepare(); connection connection = new bluetoothconnection("ac:3f:a4:13:c2:24"); connection.open(); zebraprinter printer = zebraprinterfactory.getinstance(connection); printer.printimage(signaturefile, 100, 100); thread.sleep(2000); connection.close(); looper.mylooper().quit(); } catch (connectionexception e) { e.printstacktrace(); } catch (zebraprinterlanguageunknownexception e) { e.printstacktrace(); } catch (interruptedexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } } }).start(); }
please find link zpl language zpl programming guide in section image load
connect printer:
bluetoothconnection printerconnection = new bluetoothconnection(printeraddress); printerconnection.open(); if (!printerconnection.isconnected()) { throw new exception("could not open bluetooth connection"); } //print zebraprinter printer = zebraprinterfactory.getinstance(printerconnection); printerlanguage pl = printer.getprintercontrollanguage(); if (pl == printerlanguage.cpcl) { } else { //byte[] configlabel = createzplreceipt().getbytes(); byte[] configlabel = zplcontent.getbytes(); printerconnection.write(configlabel); } printerconnection.close(); then send zpl string printer:

Comments
Post a Comment