html5-qrcode icon indicating copy to clipboard operation
html5-qrcode copied to clipboard

Unable to scan CODE_39 Barcode correctly

Open nasqasim opened this issue 2 years ago • 5 comments

Describe the bug Trying to scan a CODE_39 type barcode and getting different results

To Reproduce Steps to reproduce the behavior:

  1. Scan the barcode shared as screenshot
  2. Try multiple Times , the answer should be 0825964 , but getting different results when scanning each time
  3. I have also shared response list from demo URL

Expected behavior Getting different results when scanning each time

Screenshots WhatsApp Image 2023-01-19 at 4 57 41 PM

WhatsApp Image 2023-01-19 at 5 00 27 PM

nasqasim avatar Jan 19 '23 11:01 nasqasim

I am also experiencing this issue with UPC-A, UPC-E, EAN-13, EAN-8 and ITF. It is consistently scanning, but produces random numbers approximately 2 out of 5 times. This is happening on all device types. Chrome browser, Android Pixel 4a, iPhone XR, iPhone SE etc.

Caitlin-Finn avatar Feb 24 '23 17:02 Caitlin-Finn

Ah, I am able to reproduce this. This should be due to error in underlying system.

Let me see what can be done on my end to address this.

mebjas avatar Feb 25 '23 04:02 mebjas

@mebjas great, thank you! Let me know if there is anything I can help with.

Caitlin-Finn avatar Feb 27 '23 13:02 Caitlin-Finn

any updates?

seems that if i upload the barcode image it will decode it correctly... i tried with zxing-js-scanner and it works:

<script src="{{ asset('js/zxing-library-0.20.0.min.js') }}"></script> 
    <script type="text/javascript">
       $(document).ready(function() {
            //https://github.com/zxing-js/library srcjs: https://unpkg.com/@zxing/library@latest/umd/index.min.js
            const constraints = {
                audio: false,
                video: {
                    facingMode: { exact: "environment" },
                    width: { ideal: 200 },
                    height: { ideal: 300 }
                }
            };
            const codeReader = new ZXing.BrowserMultiFormatReader();
            codeReader.decodeOnceFromConstraints(constraints, 'video')
            .then(result => {
                $('#codice_articolo').val("");
                $('#codice_articolo').val(result.text);
                $('#video').hide();
                $('#quantita_rilevata').focus();
                codeReader.reset();
            })
            .catch(err => {
                // Display a Bootstrap alert with the error message
                const alertContainer = $('#alert-container');
                const errorMessage = err.message && 'Errore! prova a ricaricare la pagina e consenti a questo sito di accedere alla fotocamera.';
                const alertHtml = `
                    <div class="alert alert-danger alert-dismissible fade show" role="alert">
                        ${errorMessage}
                    </div>
                `;
                alertContainer.html(alertHtml);
            });
        });
    </script>
    

EDIT: maybe we need to update this library with the latest zxing js?

Smig0l avatar Nov 20 '23 16:11 Smig0l

Any update on this? struggling with the same issue.

ollejernstrom avatar Feb 28 '24 08:02 ollejernstrom