
IBaiduOcr
Character recognition
BootstrapBlazor.BaiduOcr
, which needs to reference its component package when using this componentBootstrapBlazor.BaiduOcr
componentdotnet add package BootstrapBlazor.BaiduOcr
<PackageReference Include="BootstrapBlazor.BaiduOcr" Version="7.1.1" />
Install-Package BootstrapBlazor.BaiduOcr
IBaiduOcr
instance by inject serviceIBaiduOcr
instance methodCall Baidu Ocr interface for text recognition by uploading VAT invoice image
Demo
通过调用 IBaiduOcr
服务实例的发票验真方法 VerifyInvoiceAsync
返回 InvoiceVerifyResult
其属性 Valid
为 true
时为真
Demo
发票种类
@page "/ocr"
@inject IStringLocalizer<BaiduOcr> Localizer
<h3>IBaiduOcr</h3>
<h4>Character recognition</h4>
<Tips class="mt-3">本组件通过调用 Baidu AI 平台文字识别接口进行增值税发票文字识别。支持对增值税普票、专票、全电发票(新版全国统一电子发票,专票/普票)、卷票、区块链发票的所有字段进行结构化识别,包括发票基本信息、销售方及购买方信息、商品信息、价税信息等,其中五要素字段的识别准确率超过 99.9%; 同时,支持对增值税卷票的 21 个关键字段进行识别,包括发票类型、发票代码、发票号码、机打号码、机器编号、收款人、销售方名称、销售方纳税人识别号、开票日期、购买方名称、购买方纳税人识别号、项目、单价、数量、金额、税额、合计金额(小写)、合计金额(大写)、校验码、省、市,四要素字段的识别准确率可达95%。上传图片不能超过 4M</Tips>
<PackageTips Name="BootstrapBlazor.BaiduOcr" />
<div class="mb-2"><b>Usage</b></div>
<div>1. Get <code>IBaiduOcr</code> instance by inject service</div>
<div>2. Call <code>IBaiduOcr</code> instance method</div>
<DemoBlock Title="VAT Invoice" Introduction="Call Baidu Ocr interface for text recognition by uploading VAT invoice image" Name="VatInvoice" Demo="typeof(Demos.BaiduOcr.BaiduOcrNormal)" />
<DemoBlock Title="增值税验真" Introduction="通过调用 <code>IBaiduOcr</code> 服务实例的发票验真方法 <code>VerifyInvoiceAsync</code> 返回 <code>InvoiceVerifyResult</code> 其属性 <code>Valid</code> 为 <code>true</code> 时为真" Name="Verify" Demo="typeof(Demos.BaiduOcr.BaiduOcrVerifyVatInvoice)">
<h4 class="mb-2">发票种类</h4>
<div>增值税专用发票:special_vat_invoice</div>
<div>增值税电子专用发票:elec_special_vat_invoice</div>
<div>增值税普通发票:normal_invoice</div>
<div>增值税普通发票(电子):elec_normal_invoice</div>
<div>增值税普通发票(卷式):roll_normal_invoice</div>
<div>通行费增值税电子普通发票:toll_elec_normal_invoice</div>
<div>区块链电子发票(目前仅支持深圳地区):blockchain_invoice</div>
<div>全电发票(专用发票):elec_invoice_special</div>
<div>全电发票(普通发票):elec_invoice_normal</div>
<div>货运运输业增值税专用发票:special_freight_transport_invoice</div>
<div>机动车销售发票:motor_vehicle_invoice</div>
<div class="mb-3">二手车销售发票:used_vehicle_invoice</div>
</DemoBlock>
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/
namespace BootstrapBlazor.Shared.Samples;
/// <summary>
/// 百度文字识别示例
/// </summary>
public partial class BaiduOcr
{
}