Java example for network printing

Article ID: 74875701


Topic or Information

Java example for printing via a network connection

Applies To

Java programming for Zebra Printers


The following is a simple example that illustrates how one is able to use Java to print via a network connection.

class TCPClient
     public static void main (String argv[]) throws Exception
           // The line below illustrates the default port 6101 for mobile printers 9100 is the default port number
    // for desktop and tabletop printers
    Socket clientSocket=new Socket("",6101);

    DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream() );
           //The data being sent in the lines below illustrate CPCL  one can change the data for the corresponding 
           //language being used (ZPL, EPL)   
    outToServer.writeBytes("! 0 200 200 203 1" + 'n' + "CENTER" + 'n');
           outToServer.writeBytes("TEXT 0 3 10 50 JAVA TEST" + 'n' + "PRINT" + 'n');





+ Product Codes