1
0
Fork
You've already forked python-barcode
0

text above the barcode #51

Open
opened 2019年09月22日 04:19:50 +02:00 by blutme · 1 comment
blutme commented 2019年09月22日 04:19:50 +02:00 (Migrated from github.com)
Copy link

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.

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.
djaychela commented 2019年09月26日 13:48:23 +02:00 (Migrated from github.com)
Copy link

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.

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.
Sign in to join this conversation.
No Branch/Tag specified
main
pre-commit-ci-update-config
extensibility
fix_sizes
feature/longer_guard_bar
ean-without-checksum
readme-formatting
cleaning
cleanup
srolin/master
michieldwitte/left-alignment-fix
v0.13.1
v0.13.0
v0.12.0
v0.11.0
v0.10.0
v0.9.0
v0.8.3
v0.8.2
v0.8.1
v0.8.0
0.8beta1
0.7
0.7beta4
0.7beta3
0.7beta2
v0.6
v0.6b3
v0.6b2
v0.6b1
v0.5.0
v0.5.0b1
v0.4.3
v0.4.2
v0.4.1
v0.4
v0.4b2
v0.4b1
v0.3
v0.3b1
v0.2.1
v0.1
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
WhyNotHugo/python-barcode#51
Reference in a new issue
WhyNotHugo/python-barcode
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?