Invoice OCR .NET

The .NET OCR SDK supports the invoice API for extracting data from invoices.

Using this sample invoice below, we are going to illustrate how to extract the data that we want, using the OCR SDK.
sample invoicesample invoice

Quick Start

// Load a file from disk and parse it

string path = "./a74eaa5-c8e283b-sample_invoice.jpeg";
var prediction = await _mindeeClient
    .LoadDocument(File.OpenRead(Path), System.IO.Path.GetFileName(Path))
    .ParseAsync<InvoiceV3Prediction>();

// Print a summary of the parsed data
System.Console.WriteLine(prediction.Inference.Prediction.ToString());

Output:

-----Invoice data-----
Invoice number: 14
Total amount including taxes: 2608.2
Total amount excluding taxes: 2415.0
Invoice date: 2018-09-25
Invoice due date: 2018-09-25
Supplier name: TURNPIKE DESIGNS CO.
Supplier address: 156 University Ave, Toronto ON, Canada M5H 2H7
Customer name: JIRO DOI
Customer company registration: 
Customer address: 1954 Bloon Street West Toronto, ON, M6P 3K9 Canada
Payment details: 
Company numbers: 
Taxes: 193.2 8.0%
Total taxes: 193.2
Locale: en; en; CAD;
----------------------

Properties

Each properties of the object contains at a minimum the following attributes:

  • Value (string or double depending on the field type):
    Corresponds to the field value. Can be null if no value was extracted.
  • Confidence (a double):
    The confidence score of the field prediction.
  • Polygon (a List<List<double>>):
    Contains the relative vertices coordinates (points) of a polygon containing the field in the image.

Extracted Fields

Attributes that will be extracted from the document and available in the Invoice object:

Customer Information

  • CustomerName (StringField): Customer's name

  • CustomerAddress (StringField): Customer's postal address

  • CustomerCompanyRegistration (List): Customer's company registration

Dates

Date fields:

  • contain the raw attribute, which is the textual representation found on the document.
  • have a value attribute which is the ISO 8601 representation of the date, regardless of the raw contents.

The following date fields are available:

  • Date: Date the invoice was issued

  • DueDate: Payment due date of the invoice.

Locale

Locale (Locale): Locale information.

  • Locale.Language (string): Language code in ISO 639-1 format as seen on the document.
    The following language codes are supported: ca, de, en, es, fr, it, nl and pt.

  • Locale.Currency (string): Currency code in ISO 4217 format as seen on the document.
    The following country codes are supported: CAD, CHF, GBP, EUR, USD.

  • Locale.Country (string): Country code in ISO 3166-1 alpha-2 format as seen on the document.
    The following country codes are supported: CA, CH, DE, ES, FR, GB, IT, NL, PT and US.

Payment Information

PaymentDetails (List): List of invoice's supplier payment details. Each object in the list contains extra attributes:

  • Iban (string)
  • Swift (string)
  • RoutingNumber (string)
  • AccountNumber (string)

Supplier Information

CompanyRegistration (List): List of detected supplier's company registration numbers. Each object in the list contains an extra attribute:

Taxes

Taxes (List): Contains tax fields as seen on the receipt.

  • Value (double): The tax amount.
  • Code (string): The tax code (HST, GST... for Canadian; City Tax, State tax for US, etc..).
  • Rate (double): The tax rate.

Total Amounts

  • TotalIncl (AmountField): Total amount including taxes.

  • TotalExcl (AmountField): Total amount excluding taxes.

  • TotalTax (AmountField): Total tax value from tax lines.

 

Questions?
Slack Logo IconSlack Logo Icon  Join our Slack