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)

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)

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 milestone
No project
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
No description provided.