Skip to content
forked from AshleyDeng/csZBar

Cordova plugin to integrate with the ZBar barcode scanning library.

License

Notifications You must be signed in to change notification settings

showpass/csZBar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZBar Barcode Scanner Plugin

This plugin integrates with the ZBar library, exposing a JavaScript interface for scanning barcodes (QR, 2D, etc). This repo has been forked from AshleyDeng's repository In this fork, the camera preview on Android is now in a window, defaulting to the top half of the screen. The camera preview is now also kept active, returning results continually instead of closing after one result returned. Lastly there is also now a cancel button in the window, allowing the preview to be closed either from the preview or from an external signal (back button, programmatically, etc).

Installation

cordova plugin add cordova-plugin-cszbar

API

Scan barcode

cloudSky.zBar.scan(params, onSuccess, onFailure)

Arguments:

  • params: Optional parameters:

    {
        text_title: "OPTIONAL Title Text - default = 'Scan QR Code'", // Android only
        text_instructions: "OPTIONAL Instruction Text - default = 'Please point your camera at the QR code.'", // Android only
        camera: "front" || "back" // defaults to "back"
        flash: "on" || "off" || "auto" // defaults to "auto". See Quirks
        height: 0.1-1.0 (Float) //defaults to 0.5, Android only
    }
  • onSuccess: function (s) {...} Callback for successful scan.

  • onFailure: function (s) {...} Callback for cancelled scan or error.

Return:

  • success('scanned bar code') Successful scan with value of scanned code
  • error('cancelled') If user cancelled the scan (with back button etc)
  • error('misc error message') Misc failure

Scan barcode

cloudSky.zBar.cancel()

Return:

  • success('cancelled') Successfully cancelled
  • error('misc error message') Misc failure

Status:

  • Android: DONE
  • iOS: DONE

LICENSE Apache 2.0

This plugin is released under the Apache 2.0 license, but the ZBar library on which it depends (and which is distribute with this plugin) is under the LGPL license (2.1).

Thanks

Thank you to @PaoloMessina and @nickgerman for code contributions.

About

Cordova plugin to integrate with the ZBar barcode scanning library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 60.5%
  • Objective-C 23.0%
  • Java 15.9%
  • JavaScript 0.6%