Socket
Socket
Sign inDemoInstall

@thegrizzlylabs/cordova-plugin-genius-scan

Package Overview
Dependencies
Maintainers
2
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thegrizzlylabs/cordova-plugin-genius-scan - npm Package Compare versions

Comparing version 2.5.1 to 3.0.0-beta3

src/android/libs/gs-sdk-ui.aar

2

package.json
{
"name": "@thegrizzlylabs/cordova-plugin-genius-scan",
"version": "2.5.1",
"version": "3.0.0-beta3",
"description": "Cordova Plugin for Genius Scan SDK",

@@ -5,0 +5,0 @@ "author": "TheGrizzlyLabs <sdk@thegrizzlylabs.com> (https://www.thegrizzlylabs.com/)",

@@ -85,62 +85,41 @@ # Genius Scan SDK Cordova plugin

Once the `deviceReady` Cordova event has been fired, the following method will be available:
Once the `deviceReady` Cordova event has been fired, the following methods will be available:
### Set the licence key
```javascript
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.
Initialize the SDK with a valid licence key:
| Param | Type | Description |
| --- | --- | --- |
| licenceKey | String | Genius scan licence key for your application id |
| onSuccess | Function | Success callback function, called when key is valid |
| onFail | Function | [Error callback](#error-callback)|
### Scan an existing image
```javascript
cordova.plugins.GeniusScan.scanImage(imageFileUri, onSuccess, onFail, scanOptions)
cordova.plugins.GeniusScan.setLicenceKey(licenceKey, onSuccess, onFail)
```
| Param | Type | Description |
| --- | --- | --- |
| imageFileUri | String | file URI to the original JPEG file to be transformed with the plugin (Note: it won't be overriden by the plugin) |
| onSuccess(jsonResult) | Function | Callback function, called with the `originalImageUri` and `enhancedImageUri` |
| onFail | Function | [Error callback](#error-callback)|
| scanOptions | Object | [Scan Options](#scan-options) |
`setLicenseKey` returns a promise that is resolved if the licence key is valid and rejected if it is not. Note that, for testing purpose, you can also use the plugin without a licence key, but it will only work for 60 seconds.
### Scan a picture from the camera
```javascript
cordova.plugins.GeniusScan.scanCamera(onSuccess, onFail, scanOptions)
```
### Start the scanner module
| Param | Type | Description |
| --- | --- | --- |
| onSuccess(jsonResult) | Function | Callback function, called with the `originalImageUri` and `enhancedImageUri` |
| onFail | Function | [Error callback](#error-callback)|
| scanOptions | Object | [Scan Options](#scan-options) |
### Generate a pdf from images
```javascript
cordova.plugins.GeniusScan.generatePDF(imageFileUris, onSuccess, onFail, pdfOptions)
cordova.plugins.GeniusScan.scanWithConfiguration(configuration, onSuccess, onFail)
```
| Param | Type | Description |
| --- | --- | --- |
| imageFileUris | Array<String> | Array of URIs to JPEG files that will be converted, in the given order, into a pdf
| onSuccess(fileUri) | Function | Callback function, called with the file URI of the resulting PDF |
| onFail | Function | [Error callback](#error-callback)|
| pdfOptions | Object | Options for pdf generation |
| pdfOptions.password | String | Password to protect the pdf |
The method `scanWithConfiguration` takes a `configuration` parameter which can take the following options:
### Scan options
- `source`: `camera` or `imageUrl` (defaults to camera)
- `sourceImageUrl`: an absolute image url, required if `source` is `image`. Example: `file:///var/…/image.png`
- `multiPage`: boolean (defaults to true). If true, after a page is scanned, a prompt to scan another page will be displayed. If false, a single page will be scanned.
- `defaultFilter`: `none`, `blackAndWhite`, `color`, `photo` (by default, the filter is chosen automatically)
- `pdfPageSize`: `fit`, `a4`, `letter`, defaults to fit.
- `postProcessingActions`: an array with the desired actions to display during the post processing screen (defaults to all actions). Possible actions are `rotate`, `editFilter`.
- `flashButtonHidden`: boolean (default to false)
- `defaultFlashMode`: `auto`, `on`, `off` (default to `off`)
- `foregroundColor`: string representing a color, must start with a `#`. The color of the icons, text (defaults to '#ffffff').
- `backgroundColor`: string representing a color, must start with a `#`. The color of the toolbar, screen background (defaults to black)
- `highlightColor`: string representing a color, must start with a `#`. The color of the image overlays (default to blue)
- `menuColor`: string representing a color, must start with a `#`. The color of the menus (defaults to system defaults.)
`scanOptions` can be used to customize the scanning interface:
It returns a promise with `result` object containing:
| Param | Type | Description |
| --- | --- | --- |
| scanOptions.defaultEnhancement | String | Force a specific image enhancement by default. Accepted values: `cordova.plugins.GeniusScan.ENHANCEMENT_NONE`, `cordova.plugins.GeniusScan.ENHANCEMENT_BW`, `cordova.plugins.GeniusScan.ENHANCEMENT_COLOR`, `cordova.plugins.GeniusScan.ENHANCEMENT_PHOTO` |
- `pdfUrl` : a PDF file of the scanned pages (example: "file://<filepath>.pdf")
- `scans`: an array of scan objects. Each scan object has:
- `originalUrl`: The original file as scanned from the camera. "file://<filepath>.jpeg"
- `enhancedUrl`: The cropped and enhanced file, as processed by the SDK. "file://<filepath>.jpeg"

@@ -189,42 +168,3 @@ ### Error callback

# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.5.1] - 2019-05-07
### Changed
- Fixed typos
- [Android] Fixed layout issue
## [2.5.0] - 2019-04-30
### Changed
- Page format for PDF generation is FIT rather than A4
- PDF title is used for filename, in addition to PDF metadata
- [Android] Image type was incorrectly detected on original image, instead of warped image
### Added
- Document detection status
- Scan functions now return original image Uri, in addition to enhanced image
## [2.4.2] - 2019-02-27
### Changed
- Compatibility with android-cordova >= v7.0.0
### Added
- `ENHANCEMENT_NONE` default enhancement option
- Cancel button on iOS camera screen
- Auto trigger in Android
## [2.4.1] - 2018-12-05
### Changed
- Fix README
## [2.4.0] - 2018-12-05
### Added
- PDF generation with `generatePDF`
- Selecting an enhancement type by default with `defaultEnhancement` option
### Changed
- Fix crash on ipad when clicking "Edit" button
- Fix error with too long activity result code
See [changelog](https://www.thegrizzlylabs.com/document-scanner-sdk/changelog/)
// Note: we avoid ES6 in cordova JS, because underlying webview might not be compatible.
var exec = require("cordova/exec");
exports.scanImage = function(imageFileUri, onSuccess, onError, scanOptions) {
scanOptions = scanOptions || {}
exec(onSuccess, onError, "GeniusScan", "scanImage", [imageFileUri, scanOptions]);
exports.scanWithConfiguration = function(configuration, onSuccess, onError) {
configuration = configuration || {}
exec(onSuccess, onError, "GeniusScan", "scanWithConfiguration", [configuration]);
};
exports.scanCamera = function(onSuccess, onError, scanOptions) {
scanOptions = scanOptions || {}
exec(onSuccess, onError, "GeniusScan", "scanCamera", [scanOptions]);
};
exports.generatePDF = function(title, imageFileUris, onSuccess, onError, pdfOptions) {
pdfOptions = pdfOptions || {}
exec(onSuccess, onError, "GeniusScan", "generatePDF", [title, imageFileUris, pdfOptions]);
};
exports.setLicenceKey = function(licenceKey, onSuccess, onError) {
exec(onSuccess, onError, "GeniusScan", "setLicenceKey", [licenceKey]);
};
exports.ENHANCEMENT_NONE = 'none'
exports.ENHANCEMENT_BW = 'bw'
exports.ENHANCEMENT_PHOTO = 'color'
exports.ENHANCEMENT_COLOR = 'whiteboard'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc