ByteScout Invoice Parser SDK - C# - Parse Invoice With OCR - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Invoice Parser SDK – C# – Parse Invoice With OCR

  • Home
  • /
  • Articles
  • /
  • ByteScout Invoice Parser SDK – C# – Parse Invoice With OCR

How to Parse Invoice with OCR in C# and ByteScout Invoice Parser SDK

The tutorial below will demonstrate how to parse invoice with OCR in C#

With this source code sample, you may quickly learn how to parse invoices with OCR in C#. What is ByteScout Invoice Parser SDK? It is the SDK for automatic invoice parsing and data extraction. Thousands of companies are supported out of the box! Detects and extracts a company name, invoice number, date, total amount to be paid, and other fields. Constantly updated database of supporting invoices. Batch processing is supported. Outputs JSON, CSV, XML data and can be integrated with other apps and tools. It can help you to parse invoices with OCR in your C# application.

Fast application programming interfaces of ByteScout Invoice Parser SDK for C# plus the instruction and the code below will help you quickly learn how to parse invoices with OCR. In order to implement the functionality, you should copy and paste this code for C# below into your code editor with your app, compile and run your application. Enjoy writing a code with ready-to-use sample codes in C#.

ByteScout free trial version is available for download from our website. It includes all these programming tutorials along with source code samples.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs

      
using System; using ByteScout.InvoiceParser; // This example demonstrates the use of Optical Character Recognition (OCR) to parse invoice data // from scanned PDF documents and raster images. namespace ParseWithOCR { class Program { static void Main(string[] args) { string inputDocument1 = @".\DigitalOcean-scanned.jpg"; // Create InvoiceParser instance using (InvoiceParser invoiceParser = new InvoiceParser("demo", "demo")) { // Enable Optical Character Recognition (OCR) // in .Auto mode (SDK automatically checks if needs to use OCR or not) invoiceParser.OCRMode = OCRMode.Auto; // Set the location of OCR language data files invoiceParser.OCRLanguageDataFolder = @"c:\Program Files\ByteScout Invoice Parser SDK\ocrdata"; // Set OCR language // "eng" for english, "deu" for German, "fra" for French, etc. - according to files in "ocrdata" folder invoiceParser.OCRLanguage = "eng"; // Find more language files at https://github.com/bytescout/ocrdata Console.WriteLine({code}quot;Parsing \"{inputDocument1}\"..."); Console.WriteLine(); // Parse invoice data in JSON format string jsonString = invoiceParser.ParseDocument(inputDocument1, OutputFormat.JSON); // Display parsed data in console Console.WriteLine("Parsing results in JSON format:"); Console.WriteLine(); Console.WriteLine(jsonString); } Console.WriteLine(); Console.WriteLine("Press any key to continue..."); Console.ReadLine(); } } }

How to Parse Invoice with OCR using ByteScout Document Parser SDK

In this tutorial, we will parse invoices with OCR using C#. Let’s copy the sample code and paste it into the Visual Studio editor. I added the sample code link in the description box below. To parse invoice data, we will use the ‘ByteScout Document Parser SDK’. You can add a reference to the document parser SDK DLL in the solution explorer. Right-click on reference and select add reference. Look at the ‘ByteScout Document Parser SDK’ and add.

Doc Parser SDK OCR

Let’s copy the sample files from the folder. Then we will add our sample file in the solution explorer and set the copy to the output directory to ‘copy always’. Now set the sample template in the sample image. To make a new template, you may see the link in the description box below.

Then add your registration name and registration key and their related properties accordingly. You can get your license details in the ByteScout dashboard. After that enable the OCR mode to ‘auto’ and set the OCR resolution. We will also set the location of OCR language data files and you may set the OCR language to your own language according to files in OCR data. Our output will be in JSON format.

Now run the program and check out the JSON output.

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Invoice Parser SDK Home Page

Explore ByteScout Invoice Parser SDK Documentation

Explore Samples

Sign Up for ByteScout Invoice Parser SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Video Tutorial

prev
next