how to scan a barcode image in a meteor application

- QUESTION -

I'd like to put together a mobile-friendly data acquisition app This app would be used in a data center, which means working in a disconnected mode This app also needs to carry (on the client) a mongodb collection of ASCI| character codes, to be matched with the incoming barcodes Once being back online, this app should sync all acquired data with its back-end mongodb
Based on these requirements, I think, meteor would be a good choice
My questions is: are there meteor packages, that can scan an image, and then translate that image to an ASCII character code?

- ANSWER -

To get barcode scanning capability, use BarcodeScanner cordova plugin:
meteor add cordova:com.phonegap.plugins.barcodescanner@2.0.1
Template
<head>
  <title>Barcode Scanner</title>
</head>

<body
  {{> barcode_scanner}}
</body>

<template name="barcode_scanner">
  <button>Scan</button>
</template>
JS
if (Meteor.isCordova) {

  Template.barcode_scanner.events({
    'click button': function () {

      cordova.plugins.barcodeScanner.scan(
        function (result) {
          alert("We got a barcode\n" +
            "Result: " + result.text + "\n" +
            "Format: " + result.format + "\n" +
            "Cancelled: " + result.cancelled);
        }, 
        function (error) {
          alert("Scanning failed: " + error);
        }
     );

    }

  });

}
For offline data capability, take a look GroundDB

0 comments:

Post a Comment

Powered by Blogger.