Esempio n. 1
0
    def veri():
        df = pd.read_excel(r'C:\Users\DELL\Desktop\barcode_test.xlsx')
        eski_barcode = df['eski'].tolist()
        yeni_barcode = df['yeni'].tolist()
        count = 0
        #dictionary = dict(zip(eski_barcode, yeni_barcode))
        for eski in eski_barcode:
            if readed_barcode_ == str(eski):
                new_barcode_ = yeni_barcode[count]
                print(new_barcode_)

                zdoc = ZPLDocument()
                zdoc.add_comment(" TEX {}".format(new_barcode_))
                zdoc.add_field_origin(20, 20)
                zdoc.add_print_quantity(2)
                code128_data = str(new_barcode_)
                bc = Code128_Barcode(code128_data, 'N', 100, 'Y')
                zdoc.add_barcode(bc)
                print(zdoc.zpl_text)

                # Get PNG byte array
                png = zdoc.render_png(label_width=2, label_height=1)
                # render fake file from bytes
                fake_file = io.BytesIO(png)
                img = Image.open(fake_file)
                # Open image with the default image viewer on your system
                img.show()

            else:
                pass
            count += 1
Esempio n. 2
0
    def generateLabel(self,
                      dcNo='0',
                      upc='0',
                      title='',
                      price='$0',
                      ip_add='10.1.10.155',
                      width=2.25,
                      height=1.25):

        zpl = ZPLDocument()
        zpl.add_comment('DC No')
        zpl.add_field_origin(320, 25)
        zpl.add_font('A', zpl._ORIENTATION_NORMAL, 10)
        zpl.add_field_data(str(dcNo))

        zpl.add_comment('UPC')
        upcPos = self.__getUPCPosition(upc)
        zpl.add_field_origin(int(upcPos), 50)
        code128_data = str(upc)
        bc = Code128_Barcode(code128_data, 'N', 50, 'Y')
        zpl.add_barcode(bc)

        zpl.add_comment('Date')
        zpl.add_field_origin(30, 180)
        zpl.add_font('S', zpl._ORIENTATION_NORMAL, 16)
        zpl.add_field_data(datetime.datetime.now().strftime('%d/%m/%Y'))

        zpl.add_comment('Price')
        zpl.add_field_origin(290, 180)
        zpl.add_font('G', zpl._ORIENTATION_NORMAL, 18)
        zpl.add_field_data(str('$' + price))
        self.printZPL(zpl)
Esempio n. 3
0
def test_comment():
    zdoc = ZPLDocument()
    zdoc.add_comment('Testing Comment')
    assert zdoc.zpl_bytes == b'^XA\n^FXTesting Comment^FS\n^XZ'
Esempio n. 4
0
from simple_zpl2 import ZPLDocument, QR_Barcode

zpl = ZPLDocument()

zpl.add_comment('Create a QR Code')
zpl.add_field_origin(20, 20)
qr_data = 'This is data inside a QR code.  This is a barcode often read by cell phones.'
qr = QR_Barcode(qr_data, 2, 2, zpl._QR_ERROR_CORRECTION_STANDARD)
zpl.add_barcode(qr)

zpl.add_comment('Now some text')
zpl.add_field_origin(200, 20)
zpl.add_font('C', zpl._ORIENTATION_NORMAL, 15)
zpl.add_field_data('Text on Label')

# Print generated text
print(zpl.zpl_text)
Esempio n. 5
0
from simple_zpl2 import ZPLDocument, Code128_Barcode

# Each label is built with a ZPLDocument object
zdoc = ZPLDocument()
zdoc.add_comment("Barcode and text")
zdoc.add_field_origin(20, 20)
code128_data = 'TEST BARCODE'
bc = Code128_Barcode(code128_data, 'N', 30, 'Y')
zdoc.add_barcode(bc)
print(zdoc.zpl_text)
Esempio n. 6
0
from zebra import Zebra
from simple_zpl2 import NetworkPrinter, ZPLDocument, Code128_Barcode

prn = NetworkPrinter('10.243.243.100', '5964')
# Each label is built with a ZPLDocument object
zdoc = ZPLDocument()
zdoc.add_comment(77777)
# zdoc.add_zpl_raw('^BY3')  # example of custom command; this ^BY command allows to˓→change barcode width (default is 2, range is 1-10)
zdoc.add_field_origin(20, 20)
code128_data = 'TEST BARCODE'
bc = Code128_Barcode(code128_data, 'N', 30, 'Y')
zdoc.add_barcode(bc)

print(zdoc.zpl_text)
print(prn)
Esempio n. 7
0
from PIL import Image
import io
from simple_zpl2 import ZPLDocument, Code128_Barcode

# Build up ZPL label
zpl = ZPLDocument()

zpl.add_comment("Barcode and text")
zpl.add_field_origin(20, 20)
code128_data = 'TEST BARCODE'
bc = Code128_Barcode(code128_data, 'N', 30, 'Y')
zpl.add_barcode(bc)

zpl.add_comment('Just Text')
zpl.add_field_origin(20, 100)
zpl.add_font('A', zpl._ORIENTATION_NORMAL, 15)
zpl.add_field_data('Just Text Here')

# Get PNG byte array
png = zpl.render_png(label_width=2, label_height=1)
# render fake file from bytes
fake_file = io.BytesIO(png)
img = Image.open(fake_file)
# Open image with the default image viewer on your system
img.show()

import socket
from simple_zpl2 import ZPLDocument, Code128_Barcode

# Each label is built with a ZPLDocument object
zdoc = ZPLDocument()
zdoc.add_comment(" TEX 7332262815348")
zdoc.add_field_origin(20, 20)
code128_data = '7332262815348'
bc = Code128_Barcode(code128_data, 'N', 30, 'Y')
zdoc.add_barcode(bc)

print(zdoc.zpl_text)

#Connection
mysocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = "10.80.209.106"
port = 9100
try:
    mysocket.connect((host, port))  # connecting to host
    #mysocket.send(b"zdoc.zpl_text")  # using bytes
    mysocket.send(zdoc.zpl_bytes)  # using bytes
    mysocket.close()  # closing connection
except:
    print("Error with the connection")