The team is not understood Zebra iMZ320

I am trying to print a shortcut from an Android application to a Zebra printer (iMZ 320), but it does not seem to understand my command line.

When I try to run this sample code, the printer prints all the commands on paper when I send them to the printer:

zebraPrinterConnection.write("^XA^FO50,50^ADN,36,20^FDHELLO^FS^XZ".getBytes());

I read the ZPL programming tutorial from the official Zebra website, but I cannot figure out how to make my printer suitable with the ZPL commands.

+5
source share
2 answers

Zebra iMZ . , ZPL, , . ZPL . :

! U1 setvar "device.languages" "zpl"

: "hybrid_xml_zpl" "zpl"

, ( ) . Zebra Setup Utilities "" , "" .

Zebra: http://www.zebra.com/us/en/products-services/software/manage-software/zebra-setup-utility.html

ZPL . 705 ( , ​​ ): https://support.zebra.com/cpws/docs/zpl/zpl_manual.pdf

+6

, "" BT Zebra ! Zebra.

async, :

protected Object doInBackground(Object... params) {
    //bt address
    String bt_printer = "00:22:58:31:85:68";
    String print_this = "Hello Zebra!\rThis is second line";
    //vars
    BluetoothSocket socket = null;
    BufferedReader in = null;
    BufferedWriter out = null;
    //device from address
    BluetoothDevice hxm = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(bt_printer);
    UUID applicationUUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
    try {
        //create & connect to BT socket
        socket = hxm.createRfcommSocketToServiceRecord(applicationUUID);
        socket.connect();
        in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
        out.write(print_this);
        out.flush();
        //some waiting
        Thread.sleep(3000);
        //in - nothing, just wait to close connection
        in.ready();
        in.skip(0);
        //close all
        in.close();
        socket.close();
        out.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }       
    return null;
}
+1

All Articles