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

@dani.dev.pm/cordova-plugin-mlkit-doc-scanner

v0.0.5

Published

A Cordova plugin for ML Kit Document Scanner

Readme

Cordova Plugin: ML Kit Document Scanner

An Android plugin that implements Google's ML Kit Document Scanner in a Cordova/Ionic app.

Check here the documentation for MLKit document scanner.

Installation

To install the plugin in Ionic:

ionic cordova plugin add @dani.dev.pm/cordova-plugin-mlkit-doc-scanner

Usage

import MLKitDocScanner from '@dani.dev.pm/cordova-plugin-mlkit-doc-scanner';
MLKitDocScanner.scanDocument(options)
.then((result) => {
// Handle the scan result
})
.catch((error) => {
// Handle any errors
});

// OR

const result: ScanResult = await MLKitDocScanner.scanDocument(options);

API Reference

MLKitDocScanner

The main interface for the ML Kit Document Scanner.

Methods

scanDocument(options: ScanOptions): Promise<ScanResult>

Scans a document with the given options.

  • options: Options for scanning the document (see ScanOptions interface).
  • Returns: A promise that resolves to the scan result (see ScanResult interface).

Interfaces

ScanOptions

Options for scanning documents.

| Property | Type | Description | Default | |----------|------|-------------|---------| | pageLimit? | number | The maximum number of pages to scan. | No limit | | includeJpeg? | boolean | Whether to include JPEG images in the scan result. | true | | includePdf? | boolean | Whether to include a PDF in the scan result. | true |

ScanError

Interface representing an error that occurred during document scanning.

| Property | Type | Description | |----------|------|-------------| | code | ScanErrorCode | The error code. | | message | string | The error message. |

ScanResult

Result of a document scan.

| Property | Type | Description | |----------|------|-------------| | images? | string[] | Array of image URIs if JPEG format is included. | | pdf? | string | URI of the PDF if PDF format is included. |

Error Codes

The following error codes are defined in the ScanErrorCode enum:

| Error Code | Description | |------------|-------------| | SCANNING_RESULT_NULL | The scanning result is null. | | NO_PAGES_SCANNED | No pages were scanned. | | JSON_PROCESSING_ERROR | An error occurred while processing JSON data. | | SCANNER_START_FAILED | The scanner failed to start. | | SCANNING_CANCELLED | The scanning process was cancelled by the user. | | SCANNING_FAILED | The scanning process failed for an unknown reason. |

Example

import MLKitDocScanner from '@dani.dev.pm/cordova-plugin-mlkit-doc-scanner';
const scanOptions: ScanOptions = {
    pageLimit: 5,
    includeJpeg: true,
    includePdf: true
};

try {
    const { images, pdf } = await MLKitDocScanner.scanDocument(scanOptions);
    console.log('Scanned jpeg of each page URIs:', images);
    console.log('Scanned PDF uri:', pdf);
} catch (error) {
    const scanError = error as ScanError;
    switch (scanError.code) {
        case ScanErrorCode.SCANNING_CANCELLED:
            console.log('User cancelled the scanning process');
            break;
        case ScanErrorCode.NO_PAGES_SCANNED:
            console.log('No pages were scanned');
            break;
    }
}