GithubHelp home page GithubHelp logo

zpl's People

Contributors

aguileragit avatar andrewachen avatar antlouiz avatar cod3monk avatar gamegrime avatar humphreybas avatar ildarakhmetov avatar jeff-woods avatar jiandk avatar jkstrick avatar kareeeeem avatar knixeur avatar qdelcourte avatar sergeolacruz avatar thom-fd avatar zachmyers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zpl's Issues

Box

def draw_ellipse(self, width, height, thickness=1, color='B'):
    assert color in 'BW', "invalid color"
    self.code += "^GE,%i,%i,%i,%c" % (width, height, thickness, color)

def print_graphic(self, name, scale_x=1, scale_y=1):
    self.code += "^XG,%s,%i,%i" % (name, scale_x, scale_y)

Can't write boxes just rectangles.

def draw_ellipse(self, width, height, thickness=1, color='B'):
    assert color in 'BW', "invalid color"
    self.code += "^GE%i,%i,%i,%c" % (width, height, thickness, color)

def print_graphic(self, name, scale_x=1, scale_y=1):
    self.code += "^XG%s,%i,%i" % (name, scale_x, scale_y)

Isn't much correct without , ?

^GE80,80,1

instead of

^GE,80,80,1

Issue with encoding

@cod3monk Hey, we ran into another issue with the iso8859-1 encoding in the TCPPrinter class. We could not print any foreign language symbols. (ü,ä, à, °). We changed the encoding to utf-8 and it worked. Tested with zebra zd420.

Suppport Special Characters

Is there support for special characters? It doesn't look like it from my learning knowledge of python. I'm been messing around the last few hours with my printer try to make it work. The printer just spits out garbage for those characters. I have a method made to add "^FH" infront of the "^FD" commands and replacing special characters with hex codes according the ZPL2 dev guide. That hasn't seem to fixed it on my GK420t. I am using the Swiss 721 font that I loaded onto the printer.

Anyone have experience with Special Characters and how they handle them?

Most of my write_text lines look like this:

l.write_text(line, char_height=char_height, char_width=char_width, line_width=(label_width-2), justification='L', font='E:AH.FNT')

I'm trying to find out if it is my printer who is messing up or not.

barcode and write_text sind same origin leads to incomplete data

I followed the advice to use the barcode() function. In my code using the barcode function makes no difference. The first the characters are cut off.

def create_zebra_qr_code_special(code_to_print) :
# label = zpl.Label(50,20,300)
# height = 15
# label.origin(10, height)
# label.write_barcode(height = 20, barcode_type= 'U', check_digit='Y')
# label.write_text(code_to_print)
# label.endorigin()
# code = label.preview()
# print(code)
l = Label(50,20,12) #12 -> 300dpi
#code_to_print = '000'+code_to_print #Die ersten 3 Zeichen werden verschluckt
code_to_print =code_to_print # Die ersten 3 Zeichen werden verschluckt
height =5 #Ausrichtung Oben,Unten -> Größere Zahl = weiter unten
l.origin(5, height,justification='2')
#Mögliche Label Typen, U,C,E,X,Q,2A,3
#Q= QR-Code, C = Barcode, E = anderer Barcode
#l.barcode('C', code_to_print, height=100,check_digit='Y') # height höhe des Barcodes in keine Ahnung welcher Einheit, Strichcode
l.barcode('Q',code_to_print,height=None, check_digit='Y', magnification='5') #height höhe des Barcodes in keine Ahnung welcher Einheit
l.write_text(code_to_print)
l.endorigin()
#l.preview() #Debugging, Anzeige des labels
return l.dumpZPL()

Deprecation warning from Pillow

Following deprecation warning is shown:

DeprecationWarning: NEAREST is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.NEAREST or Dither.NONE instead.
    image = image.resize((int(width*self.dpmm), int(height*self.dpmm)), PIL.Image.NEAREST)

My settings:
MacOS,
python 3.11.0
zpl==0.1.10
pillow==9.3.0

Thank you for this library!

How to send the file to a USB connected printer on Windows

I see the printer.py file but at the lowest level it relies on:
def request_info(self, command):
raise Exception("not implemented in this printer class")
so it would seem this is not yet implemented?

I am trying to print QR codes on small labels to a USB connected printer from a Win10 Nuc (like) miniPC.

Any suggestions/guidance would be appreciated.

Label Reverse Print

@cod3monk Hi, could you add the option to implement ^LRY on the beginning of the zpl code.
The ^LR command reverses the printing of all fields in the label format. It allows a field to appear as white over black or black over white. Thank you!

QR code is omitting the first three characters

The code 12334AB988765 as an example, scans as 34AB988765 ->
image

from PIL import Image
import zpl


def printlabel(title,code):
    l = zpl.Label(25,38)  #vertical, horizontal

    l.origin(27,2) #horizontal, vertical
    l.write_text("{}".format(title), char_height=3, char_width=1.5, line_width=25, justification='L',orientation='R')
    l.endorigin()

    qr_x = 9
    qr_y = 2
    l.origin(qr_x+3, qr_y) #horizontal, vertical
    l.write_barcode(height=1, barcode_type='Q', errorCorrection='H',magnification=6)
    l.write_text('{}'.format(code))
    l.endorigin()

    l.origin(qr_x,qr_y+1) #horizontal, vertical
    l.write_text("{}".format(code), char_height=2, char_width=1.5, line_width=25, justification='L',orientation='R')
    l.endorigin()


    #Debugging
    print(l.dumpZPL())
    l.preview()

if __name__ == '__main__':
    printlabel("Project: test",'12334AB988765')

Font names

Thanks for an amazing package, really helpful!

Just one issue. For UTF-8 characters (Cyrillic in my case), I use the font E:TT0003M_.FNT. However, I can't pass it to the write_text() function. It looks like there is a limit on single-char standard font names.

Would be awesome if you could lift that limit to enable use of other fonts.

Adding Qr Code

Hello,

could you please add Barcode type "Q" for QR-Codes in the write_barcode Function?

Thank you!

QR-Code not showing the complete text

I've bin trying to create QR Codes. By verifying that the code is correct I have found out, that the first characters of the text are missing.
This happens with the code from the example as well:

Calling this function:

def create_zebra_barcode() :

l = Label(100,80)
height = 0
l.origin(0,0)
l.write_text("Problem?", char_height=10, char_width=8, line_width=60, justification='C')
l.endorigin()



height += 20
l.origin(22, height)
l.write_barcode(height=None, barcode_type='Q', magnification=4)
l.write_text('https://github.com/cod3monk/zpl')
l.endorigin()

height += 20
l.origin(0, height)
l.write_text('Happy Troloween!', char_height=5, char_width=4, line_width=60,
             justification='C')
l.endorigin()

print(l.dumpZPL())
l.preview()

Results in this zpl code:
^XA^FO0,0^A0N,120,96^FB720,1,0,C,0^FDProblem?&^FS^FO264,240^BQN,2,4,Q,7^FDhttps://github.com/cod3monk/zpl^FS^FO0,480^A0N,60,48^FB720,1,0,C,0^FDHappy Troloween!&^FS^XZ

If you are scanning the QR-Code the displayed text is: ps://github.com/cod3monk/zpl

How to use TCPPrinter class

Hello,

we cannot get the TCPPrinter class to work.
Could you please show us an example on how to initiliaze it.
We always get an error with args.utc in the initialization,
Whats should we input for args, if we should input anything?
printerTcp = zpl.TCPPrinter(host="127.0.0.1")

Thank you!

Barcode Width

is there an option to set the width of the barcode

mm conversion in draw_ellipse and draw_box missing

I hope that I don't misunderstand anything, but I was expecting functions like draw_ellipse() draw_box() to accept mm units, but the conversion is missing in these.

So I think this:
def draw_box(self, width, height, thickness=1, color='B', rounding=0): assert color in 'BW', "invalid color" assert rounding <= 8, "invalid rounding" self.code += "^GB%i,%i,%i,%c,%i" % (width, height, thickness, color, rounding)

should be like this:
def draw_box(self, width, height, thickness=1, color='B', rounding=0): assert color in 'BW', "invalid color" assert rounding <= 8, "invalid rounding" self.code += "^GB%i,%i,%i,%c,%i" % (width*self.dpmm, height*self.dpmm, thickness, color, rounding)

And maybe even the thickness should have a conversion in mm?

Exception attempting TCPPrinter.send_job

import zpl

l = zpl.Label(20,32)
l.origin(8,2)
l.barcode('Q', 'https://github.com/cod3monk/zpl/', magnification=7)
l.endorigin()

zp=zpl.TCPPrinter("<snip>")
zp.send_job(l)

zp.send_job(l) causes exception:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "<snip>\Python\3.11.0\Lib\site-packages\zpl\printer.py", line 244, in send_job
    log.exception('exception')
    ^^^^^^^^^^^^^^^
TypeError: Logger.exception() missing 1 required positional argument: 'msg'

zp.send_job(l.dumpZPL()) works fine.

After the exception occurs you must re-instantiate zp to use socket again.

Ideas for how to send this to a Zebra printer?

Thanks for the Python translater for ZPL. This is very helpful.

Do you have any insights on how to remotely send the converted ZPL to an actual Zebra printer endpoint using Python? Seems like it REALLY involved.

I'm aiming at a TLP 2824 Plus.

So far my research tells me:

  1. Printer must be setup with the 10/100 Zebra Print Server

  2. From here, I see a couple methods of remotely pushing ZPL to the printer, though neither seem direct:

  • SMTP
  • POP3 to monitor an inbox (somehow!).
  1. But these introduce more moving parts

Any leads on how I can simplify remote printing?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.