开发者社区 > 视觉智能 > 文字识别 > 正文

在文字识别ocr中,前端可以用js直接去调-增值税发票识别的接口吗?可以的话有没有代码示例?

在文字识别ocr中,前端可以用js直接去调-增值税发票识别的接口吗?可以的话有没有代码示例?我现在只开通了免费的票据凭证识别的OCR服务,还没有那个appcode,然后在这上面调用是成功了的,但是这里的skd没有js的。d6b3a62a98fcb5f963062a5db82d6c71.png

展开
收起
小小鹿鹿鹿 2023-10-15 22:06:40 96 0
2 条回答
写回答
取消 提交回答
  • 可以看下这个 https://market.aliyun.com/products/57124001/cmapi027758.html#sku=yuncode2175800000 js代码实列可以参考这个。

    var myHeaders = new Headers();
    myHeaders.append("Authorization", "APPCODE xxxx");
    myHeaders.append("Content-Type", "application/json;");

    var raw = "{\"url\":\"https://duguang-mld.oss-cn-hangzhou.aliyuncs.com/data_pool/5b03f08e0426698df86f6afbf42a0142\"}\r\n";

    var requestOptions = {
    method: 'POST',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
    };

    fetch("https://ocrapi-advanced.taobao.com/ocrservice/advanced", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));这是官网的没有sdk 需要自行签名 根据这个示例代码 https://help.aliyun.com/document_detail/469176.html?spm=a2c4g.442329.0.0.6dde4fadBXUEGR。此回答来自钉群【官方】阿里云OCR公共云客户交流群。

    2023-10-16 13:46:43
    赞同 展开评论 打赏
  • 可以的。

    RecognizeInvoice - 增值税发票识别
    https://help.aliyun.com/document_detail/442267.html?spm=a2c4g.465204.0.i4
    本接口适用场景
    阿里云增值税发票识别,是阿里云官方自研OCR文字识别产品,适用于识别增值税发票上所包含的价税合计、发票代码、发票号码等关键信息的场景。
    阿里云OCR产品基于阿里巴巴达摩院强大的AI技术及海量数据,历经多年沉淀打磨,具有服务稳定、操作简易、实时性高、能力全面等几大优势。
    本接口图片示例

    35ac199a15485d5dc83ce19da383ac50_TB1D2NXpIKfxu4jSZPfXXb3dXXa-2060-1200.jpg

    示例
    正常返回示例

    JSON格式
    {
    "RequestId": "43A29C77-405E-4CC0-BC55-EE694AD00655",
    "Data": "{ \t\"angle\": 0, \t\"data\": { \t\t\"invoiceCode\": \"031001600211\", \t\t\"invoiceNumber\": \"67516978\", \t\t\"printedInvoiceCode\": \"\", \t\t\"printedInvoiceNumber\": \"\", \t\t\"invoiceDate\": \"2017年02月12日\", \t\t\"machineCode\": \"661619906841\", \t\t\"checkCode\": \"62850389773340912868\", \t\t\"purchaserName\": \"黄宏伟\", \t\t\"purchaserTaxNumber\": \"\", \t\t\"purchaserContactInfo\": \"\", \t\t\"purchaserBankAccountInfo\": \"\", \t\t\"passwordArea\": \"<87*>>53>5023>-446>/4+83/5 >5/81<75/1931>4>>73<0+2/0/ 4378-2*7*-9<1-0>27>167/9831 3588/+/81<75/1931>4>>7571<\", \t\t\"invoiceAmountPreTax\": \"75.21\", \t\t\"invoiceTax\": \"12.79\", \t\t\"totalAmountInWords\": \"捌拾捌圆整\", \t\t\"totalAmount\": \"88.00\", \t\t\"sellerName\": \"上海电子商务有限公司\", \t\t\"sellerTaxNumber\": \"91310106552993944D\", \t\t\"sellerContactInfo\": \"上海市静安区延安中路841号东方海外大厦2601室021-62898\", \t\t\"sellerBankAccountInfo\": \"中国银行股份有限公司上海市华山路支行4403592358\", \t\t\"recipient\": \"\", \t\t\"reviewer\": \"\", \t\t\"drawer\": \"天猫超市\", \t\t\"remarks\": \"\", \t\t\"title\": \"上海增值税电子普通发票\", \t\t\"formType\": \"\", \t\t\"invoiceType\": \"电子普通发票\", \t\t\"specialTag\": \"\", \t\t\"invoiceDetails\": [{ \t\t\t\"itemName\": \"【天猫超市】倍斯特移动电源20000M毫安充电宝手机通用大容量快充\", \t\t\t\"specification\": \"\", \t\t\t\"unit\": \"\", \t\t\t\"quantity\": \"1\", \t\t\t\"unitPrice\": \"75.21\", \t\t\t\"amount\": \"75.21\", \t\t\t\"taxRate\": \"17%\", \t\t\t\"tax\": \"12.79\" \t\t}] \t}, \t\"height\": 523, \t\"orgHeight\": 523, \t\"orgWidth\": 808, \t\"prism_keyValueInfo\": [{ \t\t\"key\": \"invoiceCode\", \t\t\"keyProb\": 100, \t\t\"value\": \"031001600211\", \t\t\"valuePos\": [{ \t\t\t\"x\": 700, \t\t\t\"y\": 23 \t\t}, { \t\t\t\"x\": 700, \t\t\t\"y\": 35 \t\t}, { \t\t\t\"x\": 630, \t\t\t\"y\": 35 \t\t}, { \t\t\t\"x\": 630, \t\t\t\"y\": 22 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"invoiceNumber\", \t\t\"keyProb\": 100, \t\t\"value\": \"67516978\", \t\t\"valuePos\": [{ \t\t\t\"x\": 678, \t\t\t\"y\": 47 \t\t}, { \t\t\t\"x\": 678, \t\t\t\"y\": 60 \t\t}, { \t\t\t\"x\": 630, \t\t\t\"y\": 60 \t\t}, { \t\t\t\"x\": 630, \t\t\t\"y\": 47 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"printedInvoiceCode\", \t\t\"keyProb\": 100, \t\t\"value\": \"\", \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"printedInvoiceNumber\", \t\t\"keyProb\": 100, \t\t\"value\": \"\", \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"invoiceDate\", \t\t\"keyProb\": 100, \t\t\"value\": \"2017年02月12日\", \t\t\"valuePos\": [{ \t\t\t\"x\": 735, \t\t\t\"y\": 70 \t\t}, { \t\t\t\"x\": 735, \t\t\t\"y\": 85 \t\t}, { \t\t\t\"x\": 632, \t\t\t\"y\": 85 \t\t}, { \t\t\t\"x\": 632, \t\t\t\"y\": 70 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"machineCode\", \t\t\"keyProb\": 100, \t\t\"value\": \"661619906841\", \t\t\"valuePos\": [{ \t\t\t\"x\": 153, \t\t\t\"y\": 95 \t\t}, { \t\t\t\"x\": 153, \t\t\t\"y\": 107 \t\t}, { \t\t\t\"x\": 83, \t\t\t\"y\": 107 \t\t}, { \t\t\t\"x\": 83, \t\t\t\"y\": 95 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"checkCode\", \t\t\"keyProb\": 100, \t\t\"value\": \"62850389773340912868\", \t\t\"valuePos\": [{ \t\t\t\"x\": 762, \t\t\t\"y\": 95 \t\t}, { \t\t\t\"x\": 762, \t\t\t\"y\": 108 \t\t}, { \t\t\t\"x\": 630, \t\t\t\"y\": 108 \t\t}, { \t\t\t\"x\": 630, \t\t\t\"y\": 95 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"purchaserName\", \t\t\"keyProb\": 100, \t\t\"value\": \"黄宏伟\", \t\t\"valuePos\": [{ \t\t\t\"x\": 169, \t\t\t\"y\": 121 \t\t}, { \t\t\t\"x\": 169, \t\t\t\"y\": 136 \t\t}, { \t\t\t\"x\": 130, \t\t\t\"y\": 136 \t\t}, { \t\t\t\"x\": 130, \t\t\t\"y\": 121 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"purchaserTaxNumber\", \t\t\"keyProb\": 100, \t\t\"value\": \"\", \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"purchaserContactInfo\", \t\t\"keyProb\": 100, \t\t\"value\": \"\", \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"purchaserBankAccountInfo\", \t\t\"keyProb\": 100, \t\t\"value\": \"\", \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"passwordArea\", \t\t\"keyProb\": 100, \t\t\"value\": \"<87>>53>5023>-446>/4+83/5 >5/81<75/1931>4>>73<0+2/0/ 4378-2*7*-9<1-0>27>167/9831 3*588/+/81<75/1931>4>>7571<\", \t\t\"valuePos\": [{ \t\t\t\"x\": 768, \t\t\t\"y\": 126 \t\t}, { \t\t\t\"x\": 768, \t\t\t\"y\": 199 \t\t}, { \t\t\t\"x\": 505, \t\t\t\"y\": 199 \t\t}, { \t\t\t\"x\": 505, \t\t\t\"y\": 125 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"invoiceAmountPreTax\", \t\t\"keyProb\": 100, \t\t\"value\": \"75.21\", \t\t\"valuePos\": [{ \t\t\t\"x\": 634, \t\t\t\"y\": 360 \t\t}, { \t\t\t\"x\": 634, \t\t\t\"y\": 374 \t\t}, { \t\t\t\"x\": 576, \t\t\t\"y\": 374 \t\t}, { \t\t\t\"x\": 576, \t\t\t\"y\": 360 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"invoiceTax\", \t\t\"keyProb\": 100, \t\t\"value\": \"12.79\", \t\t\"valuePos\": [{ \t\t\t\"x\": 788, \t\t\t\"y\": 360 \t\t}, { \t\t\t\"x\": 788, \t\t\t\"y\": 374 \t\t}, { \t\t\t\"x\": 729, \t\t\t\"y\": 374 \t\t}, { \t\t\t\"x\": 729, \t\t\t\"y\": 360 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"totalAmountInWords\", \t\t\"keyProb\": 100, \t\t\"value\": \"捌拾捌圆整\", \t\t\"valuePos\": [{ \t\t\t\"x\": 246, \t\t\t\"y\": 382 \t\t}, { \t\t\t\"x\": 311, \t\t\t\"y\": 381 \t\t}, { \t\t\t\"x\": 311, \t\t\t\"y\": 395 \t\t}, { \t\t\t\"x\": 247, \t\t\t\"y\": 397 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"totalAmount\", \t\t\"keyProb\": 100, \t\t\"value\": \"88.00\", \t\t\"valuePos\": [{ \t\t\t\"x\": 628, \t\t\t\"y\": 395 \t\t}, { \t\t\t\"x\": 629, \t\t\t\"y\": 381 \t\t}, { \t\t\t\"x\": 689, \t\t\t\"y\": 382 \t\t}, { \t\t\t\"x\": 689, \t\t\t\"y\": 397 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"sellerName\", \t\t\"keyProb\": 100, \t\t\"value\": \"上海电子商务有限公司\", \t\t\"valuePos\": [{ \t\t\t\"x\": 278, \t\t\t\"y\": 407 \t\t}, { \t\t\t\"x\": 278, \t\t\t\"y\": 422 \t\t}, { \t\t\t\"x\": 129, \t\t\t\"y\": 422 \t\t}, { \t\t\t\"x\": 129, \t\t\t\"y\": 407 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"sellerTaxNumber\", \t\t\"keyProb\": 100, \t\t\"value\": \"91310106552993944D\", \t\t\"valuePos\": [{ \t\t\t\"x\": 129, \t\t\t\"y\": 427 \t\t}, { \t\t\t\"x\": 307, \t\t\t\"y\": 425 \t\t}, { \t\t\t\"x\": 307, \t\t\t\"y\": 440 \t\t}, { \t\t\t\"x\": 130, \t\t\t\"y\": 441 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"sellerContactInfo\", \t\t\"keyProb\": 100, \t\t\"value\": \"上海市静安区延安中路841号东方海外大厦2601室021-62898\", \t\t\"valuePos\": [{ \t\t\t\"x\": 128, \t\t\t\"y\": 447 \t\t}, { \t\t\t\"x\": 410, \t\t\t\"y\": 447 \t\t}, { \t\t\t\"x\": 410, \t\t\t\"y\": 461 \t\t}, { \t\t\t\"x\": 128, \t\t\t\"y\": 461 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"sellerBankAccountInfo\", \t\t\"keyProb\": 100, \t\t\"value\": \"中国银行股份有限公司上海市华山路支行4403592358\", \t\t\"valuePos\": [{ \t\t\t\"x\": 413, \t\t\t\"y\": 464 \t\t}, { \t\t\t\"x\": 413, \t\t\t\"y\": 478 \t\t}, { \t\t\t\"x\": 130, \t\t\t\"y\": 478 \t\t}, { \t\t\t\"x\": 130, \t\t\t\"y\": 464 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"recipient\", \t\t\"keyProb\": 100, \t\t\"value\": \"\", \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"reviewer\", \t\t\"keyProb\": 100, \t\t\"value\": \"\", \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"drawer\", \t\t\"keyProb\": 100, \t\t\"value\": \"天猫超市\", \t\t\"valuePos\": [{ \t\t\t\"x\": 507, \t\t\t\"y\": 490 \t\t}, { \t\t\t\"x\": 507, \t\t\t\"y\": 506 \t\t}, { \t\t\t\"x\": 456, \t\t\t\"y\": 506 \t\t}, { \t\t\t\"x\": 456, \t\t\t\"y\": 490 \t\t}], \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"remarks\", \t\t\"keyProb\": 100, \t\t\"value\": \"\", \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"title\", \t\t\"keyProb\": 99, \t\t\"value\": \"上海增值税电子普通发票\", \t\t\"valuePos\": [{ \t\t\t\"x\": 553, \t\t\t\"y\": 37 \t\t}, { \t\t\t\"x\": 553, \t\t\t\"y\": 69 \t\t}, { \t\t\t\"x\": 252, \t\t\t\"y\": 68 \t\t}, { \t\t\t\"x\": 252, \t\t\t\"y\": 36 \t\t}], \t\t\"valueProb\": 99 \t}, { \t\t\"key\": \"formType\", \t\t\"keyProb\": 100, \t\t\"value\": \"\", \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"invoiceType\", \t\t\"keyProb\": 99, \t\t\"value\": \"电子普通发票\", \t\t\"valuePos\": [{ \t\t\t\"x\": 553, \t\t\t\"y\": 37 \t\t}, { \t\t\t\"x\": 553, \t\t\t\"y\": 69 \t\t}, { \t\t\t\"x\": 252, \t\t\t\"y\": 68 \t\t}, { \t\t\t\"x\": 252, \t\t\t\"y\": 36 \t\t}], \t\t\"valueProb\": 99 \t}, { \t\t\"key\": \"specialTag\", \t\t\"keyProb\": 100, \t\t\"value\": \"\", \t\t\"valueProb\": 100 \t}, { \t\t\"key\": \"invoiceDetails\", \t\t\"keyProb\": 100, \t\t\"value\": \"[{\\"itemName\\":\\"【天猫超市】倍斯特移动电源20000M毫安充电宝手机通用大容量快充\\",\\"specification\\":\\"\\",\\"unit\\":\\"\\",\\"quantity\\":\\"1\\",\\"unitPrice\\":\\"75.21\\",\\"amount\\":\\"75.21\\",\\"taxRate\\":\\"17%\\",\\"tax\\":\\"12.79\\"}]\", \t\t\"valueProb\": 100 \t}], \t\"width\": 808 }",
    "Code": "如果识别成功,不会返回此字段",
    "Message": "如果识别成功,不会返回此字段"
    }

    2023-10-16 10:09:51
    赞同 展开评论 打赏

文字识别技术可以灵活应用于证件文字识别、发票文字识别、文档识别与整理等行业场景,满足认证、鉴权、票据流转审核等业务需求。

相关电子书

更多
阿里云智能-印刷文字识别OCR-产品介绍 立即下载
阿里巴巴读光OCR 立即下载
印刷文字识别算法设计与在线服务 立即下载