营业执照识别
[!TIP|labelVisibility:hidden|iconVisibility:hidden] navigator.bdlicensebusiness.licensebusiness(success, error,options )
支持平台:
- Android
- iOS
参数说明
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| success | Function | 是 | 成功回调函数 |
| error | Function | 是 | 失败回调函数 |
| options | Object | 是 | 数据对象 |
success函数会返回一个json字符串,识别数据扫描结果信息:
result(对象) -- 营业执照识别返回的所有数据,数据参考:https://ai.baidu.com/docs#/OCR-API/8985451cmessage(对象) -- 营业执照识别数据,其属性包含以下一项或多项:organization(String) -- 单位名称composition(String) -- 组成形式businessScope(String) -- 经营范围socialCreditCode(String) -- 社会信用代码capital(String) -- 注册资本companyType(String) -- 类型expirationDate(String) -- 有效期certificatesNumber(String) -- 证件编号address(String) -- 地址establishDate(String) -- 成立日期legalPerson(String) -- 法人imagePath(String) -- 扫描的图片存储路径
error函数会返回一个字符串,扫描错误的相关信息,错误码参考https://ai.baidu.com/docs#/OCR-API/58fd45dd
options参数为一个对象,其属性包含以下一项或多项:
imgPath(整形/ 可选) -- 扫描的图片存储路径,0:相册,1:项目路径,默认相册imgType(整形/ 可选)扫描的图片类型,0:.jpg格式,1:.png格式,默认jpg
示例代码
// 引用js
<script src='supconit://hcmobile.js'></script>
<script>
// 监听’deviceready‘事件
document.addEventListener('deviceready', onDeviceReady, false)
function onDeviceReady(){
navigator.bdlicensebusiness.licensebusiness(function (success) {
alert(success);
},function (error) {
alert(error);
},{'imgPath':1,'imgType':0});
}
</script>
响应示例代码:
{
"result": {
"words_result_num": 11,
"log_id": 0000,
"words_result": {
"社会信用代码": {
"words": "无",
"location": {
"top": 0,
"width": 0,
"height": 0,
"left": 0
}
},
"经营范围": {
"words": "设计**",
"location": {
"top": 594,
"width": 576,
"height": 297,
"left": 1
}
},
"法人": {
"words": "小明",
"location": {
"top": 420,
"width": 55,
"height": 25,
"left": 208
}
},
"单位名称": {
"words": "**公司",
"location": {
"top": 285,
"width": 225,
"height": 25,
"left": 207
}
},
"成立日期": {
"words": "无",
"location": {
"top": 0,
"width": 0,
"height": 0,
"left": 0
}
},
"证件编号": {
"words": "11222**",
"location": {
"top": 223,
"width": 142,
"height": 16,
"left": 427
}
},
"注册资本": {
"words": "300万元",
"location": {
"top": 464,
"width": 33,
"height": 25,
"left": 210
}
},
"组成形式": {
"words": "无",
"location": {
"top": 0,
"width": 0,
"height": 0,
"left": 0
}
},
"有效期": {
"words": "无",
"location": {
"top": 0,
"width": 0,
"height": 0,
"left": 0
}
},
"地址": {
"words": "浙江省**",
"location": {
"top": 373,
"width": 366,
"height": 28,
"left": 204
}
},
"类型": {
"words": "有限责任公司",
"location": {
"top": 330,
"width": 300,
"height": 25,
"left": 207
}
}
}
},
"message": {
"composition": "无",
"imagePath": "cdvfile://localhost/cache/1578988102000.jpg",
"businessScope": "设计**",
"socialCreditCode": "无",
"capital": "300万元",
"expirationDate": "无",
"companyType": "有限责任公司",
"address": "浙江省****",
"certificatesNumber": "122333**",
"establishDate": "无",
"legalPerson": "小明",
"organization": "**公司"
}
}