I am able to print labels without issue but I am unable to get the half cut feature to work. I am trying to print a string of labels without having each label completely separated from the next. I want to use the half cut feature so that each label is easily removed from the backing individually when I need it.
I've tried multiple Text objects inside one Box, I've tried multiple Labels inside one job, and I've tried sending multiple jobs at once. Here is the code that I'm using, more or less lifted from the README:
from labelprinterkit.backends.usb import PyUSBBackend
from labelprinterkit.printers import P750W
from labelprinterkit.label import Label, Text, Box, Padding
from labelprinterkit.job import Job
from labelprinterkit.constants import Media
from labelprinterkit.page import Page
text1 = Text(45, "First", '/usr/share/fonts/truetype/ubuntu/Ubuntu-B.ttf')
text2 = Text(45, "Second", '/usr/share/fonts/truetype/ubuntu/Ubuntu-B.ttf')
box1 = Box(70, text1)
box2 = Box(70, text2)
label1 = Label(box1)
label2 = Label(box2)
job = Job(Media.W12, half_cut=True)
job.add_page(label1)
job.add_page(label2)
backend = PyUSBBackend()
printer = P750W(backend)
printer.print(job)
Its worth pointing out that the way I'm creating Label objects is different from the method listed in the readme. The readme suggests using:
label = Label(box1, box2)
However, this code fails for me with:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Label.__init__() takes 2 positional arguments but 3 were given
I'm not sure if that is related or not. I noticed that in the NotAFile/labelprinterkit project that this repo is forked from, the Label object is initialized with *args, so maybe the readme was just copy/pasted.
I may simply be misunderstanding how to use the half_cut function. Any advice you could provide would be great. Thanks in advance for your help.
I am able to print labels without issue but I am unable to get the half cut feature to work. I am trying to print a string of labels without having each label completely separated from the next. I want to use the half cut feature so that each label is easily removed from the backing individually when I need it.
I've tried multiple Text objects inside one Box, I've tried multiple Labels inside one job, and I've tried sending multiple jobs at once. Here is the code that I'm using, more or less lifted from the README:
Its worth pointing out that the way I'm creating Label objects is different from the method listed in the readme. The readme suggests using:
label = Label(box1, box2)
However, this code fails for me with:
I'm not sure if that is related or not. I noticed that in the NotAFile/labelprinterkit project that this repo is forked from, the Label object is initialized with *args, so maybe the readme was just copy/pasted.
I may simply be misunderstanding how to use the half_cut function. Any advice you could provide would be great. Thanks in advance for your help.