ZBar

Contents

The ZBar Scanner Plugin allows you to scan 2d barcodes.

Requires Cordova plugin: cordova-plugin-cszbar. For more info, please see the zBar plugin docs.

https://github.com/tjwoon/csZBar

Stuck on a Cordova issue?

Installation

Community Enterprise
ionic cordova plugin add cordova-plugin-cszbar npm install @ionic-native/zbar
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More   or   Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/zbar

Supported Platforms

  • Android
  • iOS

Usage

import { ZBar, ZBarOptions } from '@ionic-native/zbar/ngx';

constructor(private zbar: ZBar) { }

...

let options: ZBarOptions = {
      flash: 'off',
      drawSight: false
    }

this.zbar.scan(options)
   .then(result => {
      console.log(result); // Scanned code
   })
   .catch(error => {
      console.log(error); // Error message
   });