The cordova plugin for the Anyline SDK

Usage no npm install needed!

<script type="module">
  import anyline from '';


Anyline SDK Cordova Plugin

Anyline provides an easy-to-use SDK for applications to enable Optical Character Recognition (OCR) on mobile devices.

Available Modules

  • Barcode: Scan 23 types of international barcode & QR code formats.
  • Energy: Scan meter readings of various electric, gas, and water meters.
  • MRZ: Reliable scanning of data from passports' and IDs' machine readable zones (MRZ)
  • Anyline OCR: Create a custom use case with LINE or GRID recognition



  • Android device with SDK >= 15
  • decent camera functionality (recommended: 720p and adequate auto focus)


  • minimum iOS 7.0
  • minimum iPhone4s

Quick Start - Setup

This is just a simple setup guide to integrate the anylinesdk-plugin in an existing Cordova project.
For more information about Cordova, how to use plugins, etc. see

1. Add the anylinesdk-plugin to your existing cordova project
cordova plugin add anyline

Or use plugman. E.g. for android:

plugman install --platform android --project platforms/android --plugin anyline
2. Plugin Usage
cordova.exec(onResult, onError, "AnylineSDK", scanMode, config);
  • onResult: a function that is called on a scan result
  • onError: a function that is called on error or when the user canceled the scanning
  • AnylineSDK: add this string to make sure the anyline-sdk plugin is called
  • scanMode: "MRZ", "BARCODE", "ANYLINE_OCR", "ELECTRIC_METER", "GAS_METER" (more Energy modes can be found here)
  • config: an array
    • config[0]: the license key
    • config[1]: the view config
    • config[2]: the ocr config (only uses with mode ANYLINE_OCR)

Example for config from MRZ:

        "captureResolution": "1080p",
        "cutout": {
            "style": "rect",
            "maxWidthPercent": "90%",
            "maxHeightPercent": "90%",
            "alignment": "top_half",
            "strokeWidth": 2,
            "cornerRadius": 4,
            "strokeColor": "FFFFFF",
            "outerColor": "000000",
            "outerAlpha": 0.3
        "flash": {
            "mode": "manual",
            "alignment": "bottom_right"
        "beepOnResult": true,
        "vibrateOnResult": true,
        "blinkAnimationOnResult": true,
        "cancelOnResult": true
3. Run your cordova project: Enjoy scanning and have fun :)

Checkout our online documentation for more details.


See LICENSE file.