Socket
Socket
Sign inDemoInstall

@thegrizzlylabs/cordova-plugin-genius-scan

Package Overview
Dependencies
0
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thegrizzlylabs/cordova-plugin-genius-scan


Version published
Maintainers
1
Created

Readme

Source

Genius Scan SDK Cordova plugin

Description

This Cordova plugin allows you to access the Genius Scan SDK core features from a Cordova application:

  • Automatic document detection
  • Document perspective correction
  • Image enhancement with 4 different modes (Grayscale, Color, Black & white, Photo)

Licence

This plugin is based on the Genius Scan SDK for which you need to setup a licence. You can aleady try the "demo" version for free by not setting a licence key, the only limitation being that the app will exit after 60 seconds.

To buy a licence or for any question regarding the SDK, please contact us at sdk@thegrizzlylabs.com!

Demo application

As an example, you can check our demo application

Requirements

This plugin requires cordova-cli above 7.0.0: see this page for upgrading if you have an older version.

Platform-specific requirements

  • iOS: cordova-ios above 4.3.0 Nothing to do on a new project; use cordova platform update ios --save within your existing cordova project to upgrade it.
  • Android: cordova-android 6.x.x The plugin is not compatible with Cordova Android 7.x.x because of structural changes (details).

Upgrade from an older version

If you are using an older plugin version, you will first need to remove the plugin from your cordova project:

cordova plugin remove cordova-plugin-genius-scan

Then you can install the new version following the instructions below.

Installation

You can install the plugin with Cordova CLI, plugman, or using the config.yml file.

Note for Phonegap, Ionic and other cordova-based tools:

You can usually run cordova commands from the phonegap/ionic cli.

  • ionic cordova prepare
  • ionic cordova plugin add ....
  • phonegap cordova prepare (or, shorter phonegap prepare)
  • ...

With Cordova CLI

From your Cordova project folder, install the plugin with the following command:

cordova plugin add cordova-plugin-genius-scan

With config.yml

Add the following lines to your project's config.yml file:

<plugin name="cordova-plugin-genius-scan" spec="~2.3.0"/>

And run cordova prepare.

With plugman

From your Cordova project folder, you can also use plugman to install the plugin only for a specific platform. /!\ Here, the path to the plugin folder must be absolute.

plugman install --platform ios --project ./platforms/ios --plugin cordova-plugin-genius-scan

Usage

Once the deviceReady Cordova event has been fired, the following method will be available:

cordova.plugins.GeniusScan.setLicenceKey(licenceKey, onSuccess, onFail)

Initialize the SDK with a valid licence key. Note that, for testing purpose, you can also use the plugin without a licence key, but it will only work for 60 seconds.

ParamTypeDescription
licenceKeyStringGenius scan licence key for your application id
onSuccess(fileUri)FunctionSuccess callback function, called when key is valid
onFail(errorMessage)FunctionError callback, when key is invalid

cordova.plugins.GeniusScan.scanImage(imageFileUri, onSuccess, onFail)

Pass the given image through document detection, perspective correction and image enhancement. It returns a promise that will resolve to the resulting imageURI, or reject in case of error.

ParamTypeDescription
imageFileUriStringfile URI to the original JPEG file to be transformed with the plugin (Note: it won't be overriden by the plugin)
onSuccess(fileUri)FunctionCallback function, called with the file URI of the processed JPEG output
onFail(errorMessage)FunctionError callback, in case something goes wrong

cordova.plugins.GeniusScan.scanCamera(onSuccess, onFail)

Same as cordova.plugins.GeniusScan.scanImage but the initial picture is taken with the camera.

ParamTypeDescription
onSuccess(fileUri)FunctionCallback function, called with the file URI of the processed JPEG output
onFail(errorMessage)FunctionError callback, in case something goes wrong

Usage with Ionic

You can use this plugin with any Cordova-based framework, for example Ionic. The way to detect that the device is ready is slightly different, but after that you also access the plugin with cordova.plugins.GeniusScan.scanImage(imageFileUri, onSuccess, onFail)

In the controller where you need the plugin, you will have to import Platform and pass it to the constructor, and also declare the cordova variable so that TypeScript recognizes it.

import { Platform } from 'ionic-angular';

declare var cordova:any;

export class HomePage {
  constructor(private platform: Platform) {
    platform.ready().then(() => {
      // platform.ready is the equivalent of the deviceReady event described above
      // the plugin method is now available:
      cordova.plugins.GeniusScan.scanCamera(...)
    });
  }

}

Keywords

FAQs

Last updated on 18 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc