Printing barcode to Zebra printer

Is it possible to print to Zebra barcode code printer from Ignition?

I’ve searched the forum and all I found was few 2 years old topics…

Did you happen to see this one?

https://inductiveautomation.com/forum/viewtopic.php?p=35268#p35268

[quote=“JordanCClark”]Did you happen to see this one?

https://inductiveautomation.com/forum/viewtopic.php?p=35268#p35268[/quote]
Yes, I’ve seen it…

The reason I’m asking is, there’s a potential project coming to our way in which the Zebra (or some other printer; I just hear that Zebra is most popular) printer and barcode labels are involved. I don’t know nothing about Zebra printers and barcode printing (I/we have no experience with this kind of printers, but I can learn… with some help :slight_smile: ), but I would very much like to use Ignition, if it’s possible. A quick look on the internet shows me that Zebra printers are mostly RS232, USB and Parallel port. Some of them can also have Ethernet (I don’t know which ones). At this point I also don’t know, which barcode printer we will/should use for this project.

I’m asking if we can print barcode labels with Ignition, so that we can say to the customer, Yes we can do it and we’ll do it with Ignition. If there are some kind of ‘special’ requirements to print barcode label from Ignition, I would like to know, so that I can be prepared, when/if it gets for real.

It looks to be a straight ASCII over Ethernet application. I have a Zebra printer or two I can hang off the network to help out.

I’ve used Python Socket to run a marquee with no issues, others use the Java Socket library for Zebra printers with apparently good results.

[quote=“JordanCClark”]It looks to be a straight ASCII over Ethernet application. I have a Zebra printer or two I can hang off the network to help out.

I’ve used Python Socket to run a marquee with no issues, others use the Java Socket library for Zebra printers with apparently good results.[/quote]
That’s much appreciated. :thumb_left:
So I can say to my boss, if the barcode printer with ethernet port is used, then I can print barcode labels from Ignition?

Based on the other thread, I’d say yes. I’ll get a printer onto the network and play-- er… research and develop…

I should have a more definitive answer and/or methodology for you tomorrow. :wink:

I have worked with a similar Intermec Printer, I found it was acceptable to create a container on screen with the aspect ratio the same as label to use, then layout all the data as labels, text, values, barcodes as controls within the container and finally use ‘system.print.createPrintJob’ to create a print job to the printer to print the container.

This allowed a label image to be show in the ignition window of the exact label printed.

Just wondering if you ever got around to attempting this? We have huge value here at our facility if we could pull this off

Don’t have my full code in front of me but this may help:

Note that I no longer recommend the python socket module in jython due to poor timing and ambiguous non-ASCII encodings. Use java.net or java.nio equivalents.

2 Likes

Finally made it back to my desk. Here’s a chopped down version of what I use.

from java.net import Socket
from java.io import DataOutputStream

partnum = 'ABCBEFGH'
serialNum = '12345678'

strMessage100 = "^XA"  
strMessage110 = "^BY3,3,60^FT065,120,^BCN,N,N,N,N^FDP%s^FS" % partNum
strMessage111 = "^FT170,040^A0N,40,45^FD%s^FS" % partNum
strMessage112 = "^FT065,260,^BCN,N,N,N,N^FDS%s^FS" % serialNum
strMessage113 = "^FT170,170^A0N,40,45^FD%s^FS" % serialNum
strMessage199 = "^PQ1,0,1,Y^XZ"

strOut = strMessage100+strMessage110+strMessage111+strMessage112+strMessage113+strMessage199
  
  
printerIP='192.168.140.61'
port=9100
 
try:
  # Open Socket Connection
  clientSocket=Socket(printerIP,port)
  #Open data output stream
  outToPrinter=DataOutputStream(clientSocket.getOutputStream())
  #Send Data to Printer
  outToPrinter.write(strOut)
  #close data stream and socket
  outToPrinter.close();
  clientSocket.close();
except IOError:
  print "Error", row
2 Likes

Called the second shift team lead and asked him to check the zebra printer and voila, like magic. Thank you both! Shouldn’t have done this before bed though, cue brain overdrive mode.

@pturmel I will look into some Java solutions for a long term permanent solution to this problem, but this is a good start

What Phil was saying was to use java libraries instead of the Jython ones. If you take a look at the imports at the top of the example I posted, you’ll see we’re using java libraries.

1 Like

Indeed. Though I haven’t seen the DataOutputStream used like that. I usually use a PrintWriter.

The java code works fine, we have similar code today printing to the zebra printers.

Recently I have been exploring the Zebra API as well. I was able to easily install the jars into Ignition and do some printing with their native API. Its actually quite good.

I’ll be switching over our current code to use their library in the future. If your using a newer zebra printer with LinkOS, the API code is even simpler and gives you a ton of options including full bi-directional status info.

I’d love to actually build a module around their API where the printers could be added as devices with tags for status and scripting functions for printing. But, with about 110% of my time consumed, that realistically won’t happen, but if some other module devs want to collaborate, let me know.

6 Likes