npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

trackscanner

v4.0.0

Published

cordova plugin for document scanner

Readme

cordova-plugin-document-scanner

Please raise a pull request if there are fixes or enhancements that you want to add!

DOCUMENTATION - This doc explains use of ver 3.x.x and ver 4.x.x. For 2.x.x and below please read the documentation within each of the npm releases.

This plugin defines a global scan object, which provides an API for scan the document from taking pictures and choosing image from the system's library.

Although the object is attached to the global scoped window, it is not available until after the deviceready event.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log(scan);
}

Installation

cordova plugin add [email protected]

Plugin versions 2.x.x and below are now deprecated. Please use 4.x.x for a stable releases and 3.x.x if you want to be able to use the WeScan Swift library This requires cordova 7.1.0+ and cordova android 6.4.0+

npm link :- https://www.npmjs.com/package/cordova-plugin-document-scanner

4.x.x uses IRLDocumentScanner ios scan Library (Objective C) - More stable because cordova works seamlessly with objective C

3.x.x uses WeScan ios scan Library (Swift)

Please read issues and fixes section of readme for Ionic & PhoneGap installation

scan.scanDoc(successCallback, errorCallback, options)

Takes a photo using the scan plugin, or retrieve a photo from the device's

image gallery. The image is passed to the document scanner and the scanned image passed to success callback as the URI for the image file.

The scan.scanDoc function opens the device's camera that allows users to snap pictures by default. Once the user snaps the photo, the scan application closes and the application is restored.

options

  • sourceType [Default value is 1] :- When sourceType in options object is 1(default) device camera opens so user can click a pic. When 0 gallery opens up so user can select an image.
    • Platform Support : Android only
    • Version Support : 3.x.x & 4.x.x
  • fileName [Default value is "image"] :- User can specify the name of the file without the file extension. File extension is always .png for now
    • Platform Support : iOS only
    • Version Support : 4.x.x only
    • Important Notes : Please cleanup the files if not using default value.

The return value is sent to the scanSuccess callback function, in fileUri format. You can do whatever you want with the URI, for example, render the image in an <img> tag.

Plugin adds file:// in front of the imageuri returned for both android and ios [iOS example imageURI returned :- file:///var/mobile/Containers/Data/Application/8376778A-983B-4FBA-B21C-A4CFDD047AAA/Documents/image.png]

Supported Platforms

  • Android

  • iOS

Example


scan.scanDoc(scanSuccess, scanError, options);

options example

{
	sourceType : 1,
	fileName : "myfile"
}

working example

Take a photo and retrieve the image's file location:

    scan.scanDoc(onSuccess, onFail, {sourceType:1, fileName:"myfilename"}); 
    // sourceType will by default take value 1 if no value is set | 0 for gallery | 1 for camera. 
    // fileName will take default value "image" if no value set. Supported only on 4.x.x plugin version

    function onSuccess(imageURI) {
        alert(imageURI);
        console.log(imageURI);
        //var image = document.getElementById('myImage');
        //image.src = imageURI; // For iOS, use image.src = imageURI + '?' + Date.now(); to solve issue 10 if unique fileName is not set.

    }

    function onFail(message) {
        alert('Failed because: ' + message);
    }

Options need not be passed in, if the default values are being used.

iOS Quirks

  • iOS has only document scan via camera for now (Any argument passed will start the camera scan). Document Scan from gallery will be available in future version. Also scanned images aren't saved to the gallery in iOS.

  • Please don't forget to delete the files if you use the fileName option to create your own filenames.

  • An example file URI obtained from success call back of scanDoc function looks like this file:///var/mobile/Containers/Data/Application/8376778A-983B-4FBA-B21C-A4CFDD047AAA/Documents/image.png

Android Quirks

NOTE :- Android allows delete of files from the file manager. In iOS this is not possible hence the use of fileName. Android won't accept the file name parameter in options.

Issues and Fixes

  • Error:Execution failed for task ':app:transformNativeLibsWithStripDebugSymbolForDebug'

Delete local ndk-bundle folder. Example location :- C:\Users\Administrator\AppData\Local\Android\sdk\ndk-bundle

  • CropViewController fails in Xcode due to Incompatible Swift Versions

Refer issue 13

  • Couldn't find "libopencv_java3.so" [Problem mainly with 64 bit build devices]

Refer issue 8

  • iOS scan UI buttons documentation

Refer issue 15

  • Adding plugin in Ionic

Refer 6th response in issue 17

  • Adding plugin in PhoneGap

Refer entire issue 22

  • iOS: multiple scan does not override the first image

Refer entire issue 10

  • Multiple scans don't override the first image | Browser caching issue

Refer issue 10

Credits / Native library links

Android :- AndroidScanner

iOS [4.x.x] :- IRLDocumentScanner

iOS [3.x.x] :- WeScan

Huge thanks to these authors for making their document scanning native libraries public.

More about us!

Find out more or contact us directly here :- http://www.neutrinos.co/

Facebook :- https://www.facebook.com/Neutrinos.co/

LinkedIn :- https://www.linkedin.com/company/25057297/

Twitter :- https://twitter.com/Neutrinosco

Instagram :- https://www.instagram.com/neutrinos.co/