Failed to scan 2D barcode

I have developed barcodescanner app in phonegap android. I can scan qrcode and barcode. But I cannot scan this 2d barcode. Is this my mistake or a code error?

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;
    }
}

      

+3


source to share


1 answer


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



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

+2


source







All Articles