It is printing but I don’t have any values from my database that is driving the label. Could someone tell me how to associate the data that is on the report (query Source) to get it to show on the label?
The script above is showing just Label. For example: ^FO50,150^ADN,36,20^FDQuantity:50 150’ it shows quantity name but I don’t know how to bring the value in.
Or you can install the printer on the gateway and print to it using
system.report.executeAndDistribute
I have numerous systems printing a few thousand labels a day to all different versions of zebras using the execute method.
Totally personal preference, but since ZPL is already such an obscure format I like using triple-quoted strings to keep it separate from code: <better example below>
Thank you for the info. My preference is not to use the ZPL since I have to deal with a third party utility.
You mentioned that I can install the printer on the Gateway and print to it using system.report.executeAndDistribute. Can you provide an example with a little more detail.Thank you!
My situation is I have jobs running on 6 different lines. each line has a Zebra barcode printer. As soon the job is completed, a FinishGood label is printed on the printer that is associated with the line. I am using a report that gets its data from several querirs and put them as a record with 8 fields. The values of these fields are the data I want to print on label. .
Thank you P. Could you be more specific on how to use what you indicated above in the grand schema of the entire code I listed early. For example, do I put this:
import socket
HOST = ‘10.81.19.189’
PORT = 9100
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
before your code above. Can you provide me with an example? Thanks…
Put together, the code would look like this - basically, create the string and send it to the printer all at once, rather than a lot of individual sendall() calls.
There’s a small bug in the script. When using %-interpolation, you should also denote the datatype you want (number, string, date, …). That’s done as %(variable)s for string %(variable)i for integer, etc.
So here, if both are integers, you should use %(TubeJob)i and %(Quantity)i. Combined, that gives the following code: