Printing a label from a Zebra ZT230 using USB connection

Thank you!

I was able to get a barcode printed out with the help of @pturmel and @JordanCClark !

I changed my foundService if statement to this:

if foundService:
			print('Found serv')
	  		strMessage100 = '^XA'
	  		strMessage112 = '^FO50,50^B3N,N,100,Y,N^FD%s^FS' % serialNum
	  		strMessage113 = '^XZ'
	  		strOut = strMessage100+strMessage112+strMessage113

Which prints out the barcode alongside the serial number. Though when I go to scan this barcode it seems that the serial number isn't within the barcode itself.

Scratch that, it seems to be printing the serial number within the barcode! :slightly_smiling_face:

Full working code for solution:

def printLabel(serialNum, printerName):
	from javax.print import PrintService, PrintServiceLookup, DocFlavor, SimpleDoc
	from java.lang import System
	from org.python.core.util import StringUtil
	from java.net import Socket
	from java.io import DataOutputStream
	  	
	foundService = False
  	printServices = PrintServiceLookup.lookupPrintServices(None, None) 
	for printService in printServices:
	  	print("Made it in loop")
	  	if printerName in printService.toString(): 
	  		              foundService = True 
	  		              # break
	  	
		if foundService:
			print('Found serv')
	  		strMessage100 = '^XA'
	  		strMessage112 = '^FO50,50^B3N,N,100,Y,N^FD%s^FS' % serialNum
	  		strMessage113 = '^XZ'
	  		strOut = strMessage100+strMessage112+strMessage113
	
	  		
	  		
	  		
	  		job = printService.createPrintJob()
	  		flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE
			byteArray = StringUtil.toBytes(strOut) 
	  		doc = SimpleDoc(byteArray, flavor, None) 
	  		job.print(doc, None)