ngx-scanner icon indicating copy to clipboard operation
ngx-scanner copied to clipboard

Cannot scan CODE_39 barcodes in Angular 14

Open Fulvia1989 opened this issue 2 years ago • 8 comments

Bug, feature request, or proposal:

When I attempt to scan a barcode with code 39, it is unable to read it, even though the type is included as an option in the BarcodeFormat enum

What is the expected behavior?

Suppose to display the encoded text from the barcode

What is the current behavior?

  • The scan never recognize code 39 barcodes, even in perfect light conditions
  • Tried both to print the barcode on a bigger scale and displaying it from an higher resolution device (as image from my phone). Nothing worked.
  • events are not even fired
  • Tried to scan other types of barcodes and just worded flawlessly.

What are the steps to reproduce?

Steps to reproduce the behavior:

  1. Attempt to scan a code 39 barcode.
  2. Observe that the scanner does not scan a code 39 barcode

Which versions of Angular, ngx-scanner, OS, TypeScript, browsers are affected?

Angular v14, @ionic/angular: v6.1.9, @zxing/browser: v0.1.1, @zxing/library: v0.19.1, @zxing/ngx-scanner": v3.6.2, Browser: Chrome v103.0.5060.134

HTML

<zxing-scanner #scanner (scanSuccess)="handleScannedCodeResult($event)" [formats]="allowedFormats" (scanError)="handleEvent($event)">

TS

@ViewChild('scanner') scanner;

allowedFormats = [ BarcodeFormat.QR_CODE, BarcodeFormat.EAN_13, BarcodeFormat.CODE_128, BarcodeFormat.DATA_MATRIX, BarcodeFormat.CODE_39, BarcodeFormat.ITF, BarcodeFormat.CODABAR, BarcodeFormat.MAXICODE ];

handleScannedCodeResult(resultString: string) { console.log('Result: ', resultString);

} handleEvent(event){ console.log(event) }

Fulvia1989 avatar Aug 01 '22 10:08 Fulvia1989

I'm having the same issue. Was this issue resolved?

TheSrinathKamath avatar Aug 03 '22 04:08 TheSrinathKamath

Not yet. I am prone to think that it is a combination of the low quality camera of the average laptop and the sensitivity of this library to recognize "fuzzy" barcodes, expecially if printed on those tipical hard plastic card (like the one I was using to test it) . I made another test by running my app on an android device, using the Cordova barcode-scanner plugin, and it scanned my barcode immediately, so it is indeed a decodable one. The only way I eas able to make this library work was to generate from an online website an identical barcode and printing it on a sheet of A4 blank paper.

Fulvia1989 avatar Aug 03 '22 14:08 Fulvia1989

Hello it seems i have the same issues with all type of barcode since Angular 14, did you find any solution to your issues ?

Razgort avatar Sep 07 '22 16:09 Razgort

Nothing changed, unfortunatelly. But I am using angular 14 in my project and I am able to scan other types of barcodes; the only problem is with code_39 and code_93...I am sorry that you are having troubles with all barcodes types instead...

Fulvia1989 avatar Sep 07 '22 17:09 Fulvia1989

i started using this package since angular 6 , everything was working fine, and now it's not =(

Razgort avatar Sep 07 '22 18:09 Razgort

Similar...Last time I used this package was with Angular 9, and I don't remember having all these problems. Now this is really frustrating, and still no answers...

Fulvia1989 avatar Sep 07 '22 19:09 Fulvia1989

Same - Angular 14, QR scanning works, no barcodes work.

// Update I managed to get something working by switching cameras on the phone.

spock123 avatar Oct 18 '22 11:10 spock123

I am having the same issue on Angular 15. code_39 will not scan despite the preview video showing the code (what I would think) large enough and with high enough resolution. Scanning code_39 with the Live preview for zxing-js/library works fine so it seems to be a problem with the ngx-scanner wrapper specifically.

I may try to work the fix myself but any guidance would be much appreciated since it's a time sensitive issue for me.

Ju-l1a avatar Oct 04 '23 11:10 Ju-l1a