cordova-plugin-baidu-ocr

1.0.7 • Public • Published

Cordova Plugin BaiduOcr

================================

Cross-platform BaiduOcr for Cordova / PhoneGap.

Follows the Cordova Plugin spec, so that it works with Plugman.

Installation

This requires cordova 7.1.0+ ( current stable v8.0.0 )

cordova plugin add cordova-plugin-baidu-ocr

It is also possible to install via repo url directly ( unstable )

cordova plugin add https://github.com/liugogal/cordova-plugin-baidu-ocr.git

注意:

1、首先需要到Baidu上注册并且申请并下载aip.license授权文件,具体操作查看:https://ai.baidu.com/docs#/OCR-Android-SDK/top

2、然后将aip.license拷贝到www/assets下面。

注意:官方说的是拷贝到android的app/src/main/assets下面,不用担心,此插件使用了hook钩子做文件拷贝,可以放心使用。

Supported Platforms

  • Android
  • iOS (come soon)

Cordova Build Usage

Using the plugin

A full example could be:

初始化(init):

    cordova.plugins.BaiduOcr.init(
        ()=>{
            console.log('init ok');
        },
        (error)=>{
            console.log(error)
        })

扫描身份证(scan id card):

    //默认使用的是本地质量控制,如果想使用拍照扫描的方式,可以修改参数为
    //nativeEnable:false,nativeEnableManual:false
    cordova.plugins.BaiduOcr.scanId(
        (result)=>{
            console.log(JSON.stringify(result));
        },
        (error)=>{
            console.log(error)
        },
        {
            contentType:"IDCardBack",
            nativeEnable:true,
            nativeEnableManual:true
        });

销毁本地控制模型(destroy):

    cordova.plugins.BaiduOcr.destroy(
        ()=>{
            console.log('destroy ok');
        },
        (error)=>{
            console.log(error)
        });

Package Sidebar

Install

npm i cordova-plugin-baidu-ocr

Weekly Downloads

2

Version

1.0.7

License

MIT

Unpacked Size

13.3 MB

Total Files

69

Last publish

Collaborators

  • liu-gogal