Untitled

mail@pastecode.io avatar
unknown
plain_text
21 days ago
952 B
2
Indexable
Never
@app.route('/print', methods=['POST'])
def printTag():
    content = request.json
    
    #bins = json.load(content['bins'])
    bins = content['bins']
    for bin in bins:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect((TCP_IP, TCP_PORT))
        #s.send(FORMAT)
        
        '''
        label += """"
        ^FO50,50
        ^A0N,65
        ^FD"""
        

        label += bin
        label += """
        ^FS
        '''
        label = "^XA^FO84,300^A0N,72,48^FB720,1,0,L,0^FD"+bin+"^FS"

        label += """
        ^RB96,8,3,3,20,24,38^FS
        ^FN0
        ^RFR,H
        ^FS
        ^HV0
        ^XZ
        """
        
        
        s.send(bytes(label, "utf-8"))
        time.sleep(1.5) #suggested by Zebra developer
        tagBytes = ""
        try:
            tagBytes = s.recv(1024)
        except KeyboardInterrupt:
            pass

        s.close()
        tag =  str(tagBytes, 'UTF-8')
Leave a Comment