Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to scan 2d barcode

I developed barcodescanner application in phonegap android.I am able to scan qrcode and barcode. But I am unable to scan this 2d barcode. Is it my fault or the code fault?

function scanCode(){

    var scanner = cordova.require("cordova/plugin/BarcodeScanner"); 

    scanner.scan(
             function(result){
                 alert("Scanned Code: " + result.text 
                 + ". Format: " + result.format
                 + ". Cancelled: " + result.cancelled);

             }, 

             function(error){
                 alert("Scan failed: " + error);
             }
         );
    }

function encodeData(){
    var data = document.getElementById("data").value;
    if (data != ''){
        cordova.plugins.barcodeScanner.encode(
            BarcodeScanner.Encode.TEXT_TYPE, data, 
            function(success){
                alert("Encode success: " + success);
            }, 

            function(fail){
                alert("Encoding failed: " + fail);
            }
        );
    }

    else{
        alert("Please enter some data.");
        return false;
    }
}
like image 589
Prathyusha Avatar asked Nov 26 '25 17:11

Prathyusha


1 Answers

That is a PDF417 barcode. It looks like the BarcodeScanner plugin has problems with that format. Try another plugin, like this one:

https://github.com/PDF417/pdf417-phonegap

like image 76
fmcato Avatar answered Nov 29 '25 10:11

fmcato



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!