text above the barcode #51
Labels
No labels
api-inconsistency
automerge
bug
contributions welcome
documentation
duplicate
enhancement
good first issue
invalid
more-information-needed
question
sync
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
WhyNotHugo/python-barcode#51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello, I would like to know if there is the possibility of put a text above the bar code?
text here
||IIIIIIllllllllII||
12345679
Thanks for your help.
I think that would mean altering the code. I have found how to alter the default text under the barcode, by adding text= to the save method, such as
image.save(path, text='text here')But that replaces the default text (the value of the barcode). I got around this by creating a text variable that includes the info I wanted - first name and last name of a user - as well as the barcode by doing this (i'm using objects which have a barcode attribute as well as first_name and last_name):
text = f'{obj.first_name} {obj.last_name.upper()} - {obj.barcode}'and then passing that to the barcode writer as so:
image.save(path, text=text)I know that's not exactly what you're looking for, but I hope that helps in the meantime.