adamchainz / treepoem

Barcode rendering for Python supporting QRcode, Aztec, PDF417, I25, Code128, Code39 and many more types.
MIT License
129 stars 26 forks source link

code93 barcodes are apparently invalid #259

Closed samuelcolvin closed 3 years ago

samuelcolvin commented 3 years ago

excellent library name, thank you.

I've been trying to generate bar codes with both code93 and code93ext. Unfortunately the barcodes generate seem to be invalid - when i try scanning them with an app on my phone and a barcode scanning site they're not recognised (when I try reading the code93 bar code from the wikipedia article it's read immediately).

My code:

from treepoem import generate_barcode
image = generate_barcode('code93', b'1234 5678')
image.convert('1').save('code93.png')

am I doing something wrong, or is there a problem with generating these barcodes?

samuelcolvin commented 3 years ago

For anyone else coming to this, I used reportlab in the end. Much more annoying interface, but code93 barcodes worked well.

adamchainz commented 3 years ago

Hi @samuelcolvin

We don't do anything particularly fancy in treepoem that could make just one kind of barcode invalid. Everything is handled by BWIPP under the hood.

In what way are the barcodes invalid? I have generated the "bad' image locally with your script, attached - can you post the working barcode?

Thanks,

Adam

code93

Techkicker33 commented 3 years ago

@adamchainz

I wonder if its a similar problem to what i'm having using your example text. Edit: using jupyter nb in vscode

`-> 3 image = treepoem.generate_barcode( 4 barcode_type='qrcode', 5 data='barcode payload',

C:\ProgramData\Anaconda3\lib\site-packages\treepoem__init__.py in generate_barcode(barcode_type, data, options) 142 def generate_barcode(barcode_type, data, options=None): 143 if barcode_type not in barcode_types: --> 144 raise NotImplementedError("unsupported barcode type {!r}".format(barcode_type)) 145 if options is None: 146 options = {}

NotImplementedError: unsupported barcode type 'qrcode'`

adamchainz commented 3 years ago

@Techkicker33 please check you have the latest version of treepoem installed. qrcode is definitely in the known types https://github.com/adamchainz/treepoem/blob/4462b386304cecaf508a512014621c27b086bf74/src/treepoem/data.py#L129 .

This is also definitely not the same error, in future please start a new issue. That includes if your problem persists with the latest version - don't reply here, start a new issue.

adamchainz commented 3 years ago

Closing due to lack of response.