Test in a live environment
Test in production without watermarks.
Works wherever you need it to.
Invoice OCR API utilizes machine learning and computer vision to transform invoice data into a format suitable for automated processing. This technology addresses manual data entry issues like delays, costs, and errors, accurately extracting details like vendor information, invoice numbers, and prices from both digital and scanned invoices.
This article will use a top-of-the-line invoice OCR API named IronOCR.
OcrInput
methodOcr.Read
method.Console.WriteLine
IronOCR, developed by Iron Software, is an OCR library offering a range of tools for developers. It uses machine learning and computer vision to extract text from scanned documents, images, and PDFs, enabling automated processing. Its APIs integrate into various languages and platforms, reducing manual data entry errors and improving efficiency. Extracted data can be analyzed and integrated into existing systems, aiding decision-making and productivity. Features like image preprocessing, barcode recognition, and file parsing increase its versatility. IronOCR empowers developers to incorporate text recognition into their applications.
Before you can start working with IronOCR, there are a few prerequisites that need to be in place. These prerequisites include:
By ensuring that these prerequisites are met, you'll be ready to dive into the process of working with IronOCR.
To get started with IronOCR, the first step is to create a new Visual Studio project.
Open Visual Studio and go to Files, then hover on New, and click on Project.
New Project
In the new window, select Console Application and click on Next.
Console Application
A new window will appear, write the name of your new project, and location and click on Next.
Project Configuration
Finally, provide the Target framework and click on Create.
Target Framework
Now your new Visual Studio project is created. Let's install IronOCR.
There are several methods for downloading and installing the IronOCR library. But here are the two simplest approaches.
IronOCR may be included in a C# project by utilizing the Visual Studio NuGet Package Manager.
Navigate to the NuGet Package Manager graphical user interface by selecting Tools > NuGet Package Manager > Manage NuGet Packages for Solution
NuGet Package Manager
After this, a new window will appear. Search for IronOCR and install the package in the project.
Select the IronOCR package in NuGet Package Manager UI
Additional language packs for IronOCR can also be installed using the same method described above.
Enter the following line in the Package Manager Console tab:
Install-Package IronOcr
Package Manager Console
The package will now download/install in the current project and be ready to use.
Using IronOCR, you can easily extract data from invoices with just a few lines of code and use that data extraction for further processes like data entry. This will replace manual data entry and many more.
Here is an example invoice to extract text from.
The sample invoice
Now, let's write the code to extract all the data from this invoice.
using IronOcr;
using System;
var ocr = new IronTesseract();
using (var input = new OcrInput(@"r2.png"))
{
var result = ocr.Read(input);
Console.WriteLine(result.Text);
}
using IronOcr;
using System;
var ocr = new IronTesseract();
using (var input = new OcrInput(@"r2.png"))
{
var result = ocr.Read(input);
Console.WriteLine(result.Text);
}
Imports IronOcr
Imports System
Private ocr = New IronTesseract()
Using input = New OcrInput("r2.png")
Dim result = ocr.Read(input)
Console.WriteLine(result.Text)
End Using
The above code gets input in the form of an image and then extracts data from that image using a Read
method from the IronTesseract
class.
Invoice Parser
You can also extract specific data from invoices like customer invoice numbers. Below is the code to extract the customer invoice number from the invoice.
using IronOcr;
using System;
using System.Text.RegularExpressions;
var orc = new IronTesseract();
using (var input = new OcrInput(@"r2.png"))
{
var result = orc.Read(input);
var linePattern = @"INV\/\d{4}\/\d{5}";
var lineMatch = Regex.Match(result.Text, linePattern);
if (lineMatch.Success)
{
var lineValue = lineMatch.Value;
Console.WriteLine("Customer Invoice number: " + lineValue);
}
}
using IronOcr;
using System;
using System.Text.RegularExpressions;
var orc = new IronTesseract();
using (var input = new OcrInput(@"r2.png"))
{
var result = orc.Read(input);
var linePattern = @"INV\/\d{4}\/\d{5}";
var lineMatch = Regex.Match(result.Text, linePattern);
if (lineMatch.Success)
{
var lineValue = lineMatch.Value;
Console.WriteLine("Customer Invoice number: " + lineValue);
}
}
Imports IronOcr
Imports System
Imports System.Text.RegularExpressions
Private orc = New IronTesseract()
Using input = New OcrInput("r2.png")
Dim result = orc.Read(input)
Dim linePattern = "INV\/\d{4}\/\d{5}"
Dim lineMatch = Regex.Match(result.Text, linePattern)
If lineMatch.Success Then
Dim lineValue = lineMatch.Value
Console.WriteLine("Customer Invoice number: " & lineValue)
End If
End Using
Invoice Scanning
IronOCR's Invoice OCR API revolutionizes data extraction from invoices using machine learning and computer vision. This technology converts invoice text and numbers into a machine-readable format, simplifying data extraction for analysis, integration, and process improvement. It offers a robust solution for automating invoice processing, improving accuracy, and optimizing workflows like accounts payable. Automated data entry from scanned invoices is also made possible with this technology.
IronOCR offers high accuracy using the best results from Tesseract, without any additional settings. It supports multipage frame TIFF, PDF files, and all popular image formats. It is also possible to read barcode values from images.
Please visit the homepage website for more information on IronOCR. For more tutorials on invoice OCR, visit the following this details invoice OCR tutorial. To know about how to use computer vision to find text such as invoice fields, visit this computer vision how-to.
9 .NET API products for your office documents