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

how to set text position? #44

Open
goog opened this issue Jul 17, 2019 · 5 comments
Open

how to set text position? #44

goog opened this issue Jul 17, 2019 · 5 comments

Comments

@goog
Copy link

goog commented Jul 17, 2019

code128_barcode

@goog goog changed the title how to set text position how to set text position? Jul 17, 2019
@blutme
Copy link

blutme commented Sep 24, 2019

You can configure several parameters, including changing the distance between the text and the barcode (.text_distance':1 option)...

for example:

def barcode_generator(x):
<indentation> ean = barcode.get('ean13', x, writer=ImageWriter())
<indentation> filename = ean.save(x, options = {'text_distance':1, 'quiet_zone':2.5, module_height':6,'font_size':16})

x="770332600000"
barcode_generator(x):

@WhyNotHugo
Copy link
Owner

Keeping this open as a reminder to improve the docs on this topic.

@toxicantidote
Copy link

As a side note, the text_distance option is the distance from the top of the barcode to the top of the text. I would have expected this to be the distance from the bottom of the barcode to the text instead, as it seems unlikely that the user would want the text and barcode to overlap.

@tytouf
Copy link

tytouf commented Oct 5, 2022

While using python-barcode I found that the text placement is incorrect. I believe text_distance is used correctly as the distance between the bottom of the barcode modules and the text but the text is drawn at the wrong place which means that for small text_distance values, the text overlaps on the barcode.

@tytouf
Copy link

tytouf commented Oct 5, 2022

I opened #177 and proposed a patch that fixes the issue when using small values of text_distance.

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

No branches or pull requests

5 participants