Cant print on printer Qln420 over network or bluetooth

E Efkan YILMAZ 3 years 5 months ago
12 1 0

Hi all i have this devices:
1 Zebra Printer model: qln420   (connection wireless and Bluetooth)
1 Pocket Honeywell, model 60sL0 with Windows Embeed HandHeld 6.5 Classic. (connection wireless and Bluetooth)
my scenario:

1) conected the pocket to wireless and can surf on internet (google.com)  (https://www.honeywellaidc.com/CatalogDocuments/7600User%20Guides/DEMOS%…)
2) connected the printer via wireless same as described here: https://www.zebra.com/content/dam/zebra/manuals/en-us/networking/mobile…

static ip: 172.16.11.207
i can ping  from my computer to the ip: 172.16.11.207
 

i tested these code on C#:
private void button1_Click(object sender, EventArgs e)        {            string ipAddress = "172.16.11.207";            int port = 6101;            port = 6101;            // CPCL Command(s)            string CPCLString = "! 0 200 200 580 ! UTILITIES" + Environment.NewLine + "BARCODE 128 .4 2 10 6 58 12345678" +                               "FORM" + Environment.NewLine + "PRINT"+ Environment.NewLine;            try            {                // Open connection                System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();                client.Connect(ipAddress, port);                // Write CPCL String to connection                System.IO.StreamWriter writer =            new System.IO.StreamWriter(client.GetStream());                writer.Write(CPCLString);                writer.Flush();                // Close Connection                writer.Close();                client.Close();            }            catch (Exception ex)            {                // Catch Exception            }         } 
3) run the program and click on the button, no error, but too not print anything.
 
4) tested too these Java code:
 
cod= "! 0 200 200 210 1\n" +      "TEXT 4 0 30 40 Hello World\n" +     "FORM\n" +     "PRINT";if (dp.conectarZebra(ip)) {            System.out.println("Imprimiendo    " + cod);            dp.sendZebra(cod);            dp.closeZebra();            return true;         } else {            System.out.println("Error no se conecto a la impresora " + ip);            //cod = "no se pudo conectar";}where:
 
public void sendZebra(String comando)    throws IOException  {    this.outToZebra.writeBytes(comando);  }   public Boolean conectarZebra(String ip)  {    try    {      clientSocket2 = new Socket();      clientSocket2.connect(new InetSocketAddress(ip, 6101), 3000);      this.outToZebra = new DataOutputStream(clientSocket2.getOutputStream());      return Boolean.valueOf(clientSocket2.isConnected());    }    catch (IOException ex)    {      System.out.println("zebra " + ex.toString());    }    return Boolean.valueOf(false);  } 
the Java Code and C# code no error of compilation no error of syntax.
run the program and click on the button, no error, but too not print anything.
 
also i tested:
 
1) Add new printer on a windows 8 with zebra utilities, added new port, specified the ip and tested from a word document.

here send the document to ip zebra Qln420 printer and printed!!!!

wich i am do wrong..
 
 
2) Other case, i want connect the printer with the pocket pc, but not lucky the honeywell never detect the printer via bluetooth, and cant connect, in both devices i have enabled the bluetooth, why? any advice?

 
Other question, why when i open the printer for put labels, close and extract 4 labels?
i loose much labels every time, see the image:

i added some photos, and want solve this problem at soon possible.
thanks Thanks

Please Register or Login to post a reply

1 Replies

E Efkan YILMAZ

Hi Miguel,
I ran through your C# code and found it is fine.  From a brief look the Java code looks fine as well.  The issue is actually how you are creating the CPCL strings.  You are very close, but CPCL is very picky about several things, especially ending in carriage returns.  Every line needs to end in a carriage return and line feed for it to work.  You also need to specify a print quantity in CPCL.
Your C# code would look like this:
string CPCLString = "! 0 200 200 580 1" + Environment.NewLine + "! UTILITIES" + Environment.NewLine + "BARCODE 128 4 2 10 6 58 12345678" + Environment.NewLine +
                               "FORM" + Environment.NewLine + "PRINT" + Environment.NewLine;

I recommend you use the following format instead.  You can't guarantee that Environment.NewLine always converts to hex 0x0D 0x0A.  That's the point, it converts to the standard for that OS.  You need to guarantee what is sent is always carriage return & line feed :
string CPCLString = "! 0 200 200 580 1\r\n! UTILITIES\r\nBARCODE 128 4 2 10 6 58 12345678\r\nFORM\r\nPRINT\r\n";

The Java code should be this:
cod= "! 0 200 200 210 1\r\n" +
     "TEXT 4 0 30 40 Hello World\r\n" +
     "FORM\r\n" +
     "PRINT\r\n";

Try this and let me know.
Robin

CONTACT
Can’t find what you’re looking for?