Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Barcode Text Size #169

Open
svn-josh opened this issue Sep 6, 2022 · 1 comment
Open

Barcode Text Size #169

svn-josh opened this issue Sep 6, 2022 · 1 comment

Comments

@svn-josh
Copy link

svn-josh commented Sep 6, 2022

Hello, i cant seem to find a way to increase the barcodetext size. Mine is pretty small now and needs to be bigger. can someone help?

import labels
from reportlab.graphics import shapes
from barcode import Code39
from barcode.writer import ImageWriter
import os

#Create Label Format(mm)
height = 100
width = 50
specs = labels.Specification(height, width, 1, 1, height, width)

#Draw Label
def draw_label(label, width, height, obj):
    # Just convert the object to a string and print this at the bottom left of
    # the label.
    label.add(shapes.Image(80, 25, width=200, height=100, path=obj))

# Create the sheet.
sheet = labels.Sheet(specs, draw_label, border=False)

#User Input
lager = int(input("Bitte das Lager angeben(z.b. 1-8):"))
regal = int(input("Bitte die Regal Nummer angeben(z.b. 10-80):"))
platz = int(input("Bitte die Platz Anzahl angeben(z.b. 0-30):"))
ebene = int(input("Bitte die Ebenen Anzahl angeben(z.b. 0-5):"))

# Add a couple of labels.
labelc = 0
ebenec = 0
platzc = 0
while True:
    barcode = f"{lager}{regal:02d}{platzc:02d}{ebenec}"
    barcodetext = f"{regal:02d}-{platzc:02d}-{ebenec:02d}"
    barcode39 = Code39(barcode, writer=ImageWriter(), add_checksum=False)
    barcode39.save(f"./temp/{lager}{regal:02d}{platzc:02d}{ebenec}", text=barcodetext)
    sheet.add_label(f"./temp/{lager}{regal:02d}{platzc:02d}{ebenec}.png")
    #os.remove(f"./temp/{lager}{regal:02d}{platzc:02d}{ebenec}.png")
    labelc += 1
    platzc += 1
    if platzc > platz:
        platzc = 1
        ebenec += 1
        if ebenec > ebene:
            break

# Save the file and we are done.
sheet.save(f'Lager-{lager}_Regal-{regal}.pdf')
for file in os.listdir("./temp"):
    if file.endswith(".png"):
        os.remove(f"./temp/{file}")

print("{0:d} label(s) output on {1:d} page(s).".format(sheet.label_count, sheet.page_count)) 
@WhyNotHugo
Copy link
Owner

See #17. PRs for this are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants