mebjas / html5-qrcode

A cross platform HTML5 QR code reader. See end to end implementation at: https://scanapp.org
https://qrcode.minhazav.dev
Apache License 2.0
4.84k stars 956 forks source link

Html5Qrcode fails to scan longer code128 barcodes #732

Open Christopher-Shorter opened 1 year ago

Christopher-Shorter commented 1 year ago

Describe the bug Html5Qrcode works incredibly well for many barcode types, but when trying to scan long code128 barcodes, like are used for the FDA's UDI barcodes, the continuous scan fails to pick them up. The image scan is able to recognize them, but only if the image is cropped absolutely perfectly. See the screenshots below for details on this.

To Reproduce Steps to reproduce the behavior:

  1. Go to html5-qrcode live demo:
  2. Select "Scan an Image File"
  3. Upload one of the provided failing images
  4. See that it fails to scan

Expected behavior barcode should be recognized and data should be parsed

Screenshots Failing Scans: image image

Perfectly cropped working scan: image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context For reference, my external barcode scanner is able to read these barcodes, and the ZXing live demo is able to pick them up as well, which really surprised me since html5-qrcode is using zxing under the hood.

Here are some sample UDIs if you'd like to generate/print your own barcodes to test: (01)00190776136109(10)5A6BFB (01)00190776136116(10)DE353D (01)00810041638793(10)DAC5C1(17)210326

Test Barcode Sheet UDI - Test Book.pdf

vishal-formyoula commented 3 months ago

Hey @Christopher-Shorter, I'm having the same issue. If you've resolved it, could you please let me know how?

Christopher-Shorter commented 3 months ago

We ended up going with a paid library called Scandit. It was worth it for us since we were using it for a production application and the performance was much better.