简体   繁体   English

角度扫描身份证到json

[英]angular scan id card into json

I have a new requirement in my AngularJS application. 我的AngularJS应用程序中有一个新要求。 When a new client (patient, in my case) is coming to the medical center for the first time, I must have the possibility to scan his/her ID card, and in this way the admission process can be speeded up, because every data included in the ID card can be automatically read into their corresponding form fields. 当新来的客户(以我为例)是第一次来医疗中心时,我必须可以扫描其身份证,这样就可以加快入院过程,因为每个数据身份证中包含的内容可以自动读取到其相应的表格字段中。 How can I do this from a computer (not from a mobile device)? 如何从计算机(而不是从移动设备)执行此操作?

The idea is having this possibility, so the form is automatically completed into my Angular JS form. 这个想法就是有这种可能性的,因此该表单会自动完成到我的Angular JS表单中。 I suppose every read field should be loaded into a JSON structure (one JSON structure for the whole form). 我想每个读取字段都应该加载到JSON结构中(整个表单使用一个JSON结构)。 If all data is correct, it is sent to my Node JS backend as usual. 如果所有数据都正确,则照常将其发送到我的Node JS后端。

Is it possible to do this in any way? 有可能以任何方式做到这一点吗? Thank you very much. 非常感谢你。

Assuming you are using USB scanner you could try something like: 假设您使用的是USB扫描仪,则可以尝试以下操作:

 var chars = []
 $document.on('keydown', function (e) {
        if (e.which === 13) {          
            //broadcast event 
            var scannerValue = chars.join("");            
            console.log('broadcast cpScannerEvent: ' + scannerValue );
            $rootScope.$broadcast('cpScannerEvent', { scanner: scannerValue });
            //clean buffer 
            chars = [];
        } else {
            chars.push(String.fromCharCode(e.which));
        }

    });

From your comments I'm am assuming that you have a scanner attached to a Windows desktop computer. 根据您的评论,我假设您有一台连接到Windows台式计算机的扫描仪。 Typically, those types of scanners have a TWAIN driver to control the scanner from the computer. 通常,这些类型的扫描仪具有TWAIN驱动程序,可以从计算机控制扫描仪。 TWAIN is a message based system and requires a Windows handle. TWAIN是基于消息的系统,需要Windows句柄。 That being said, there is no direct way to access TWAIN devices from within a browser application. 就是说,没有直接的方法可以从浏览器应用程序访问TWAIN设备。 However, you can create a service proxy to get around this. 但是,您可以创建服务代理来解决此问题。

There is a white paper that describes how to develop this type of proxy using LEADTOOLS, a 3rd party SDK: LEADTOOLS HTML5 Scanning White Paper 白皮书描述了如何使用第三方SDK LEADTOOLS开发这种类型的代理: LEADTOOLS HTML5扫描白皮书

LEADTOOLS can help you find and extract text, numeric, and date information from any driver's license or identification card, including field like: LEADTOOLS可以帮助您从任何驾驶执照或身份证上查找和提取文本,数字和日期信息,包括以下字段:

  • Name 名称
  • ID Number 身份证号
  • Address 地址
  • Gender 性别
  • Race 种族
  • Organ donor election 器官捐献者选举
  • Signature 签名
  • Date of Birth 出生日期
  • Issuing Date 发行日期
  • Expiration Date 截止日期

I would probably process and extract in the scanning proxy on the desktop since you already have the image and you will probably want to return the extracted data as JSON anyway. 由于您已经有了图像,因此我可能会在桌面上的扫描代理中进行处理和提取,并且无论如何您都可能希望将提取的数据作为JSON返回。 For more information, check out the LEADTOOLS Driver's License Recognition and Processing SDK page. 有关更多信息,请查看LEADTOOLS驾驶执照识别和处理SDK页面。

If you want to try these things out, you can for free. 如果您想尝试这些事情,可以免费使用。 Technical support is also free and can help guide you through this part of your project. 技术支持也是免费的,可以帮助您指导项目的这一部分。

Disclaimer: I work for LEAD Technologies. 免责声明:我为LEAD Technologies工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM