1. Products
  2.   OCR
  3.   .NET
  4.   Free-OCR-API-CSharp
 
  

Open Source C# .NET API for Faster OCR Text Recognition

Free C# .NET Optical Character Recognition (OCR) API for Faster Text Recognition from Images, Including Scanned Documents, Multi-page PDFs, and Photographs.

Optical Character Recognition (OCR) is a very useful technology enabling machines to read text from images as well as documents and convert it into machine-readable text. In recent times, OCR has become increasingly popular due to the rise of digitalization and the need for automated data processing. There are many OCR APIs available that developers can use to implement OCR in their applications. One such API is the Free-OCR-API-CSharp, which is an advanced free OCR API that helps software developers to creation .NET applications for handling OCR operations. The API is completely free to use and does not require any registration or subscription fees.

Free-OCR-API-CSharp is a free OCR API that allows software programmers to integrate OCR functionality into their C# applications without any external dependencies. The API uses advanced OCR technology allowing recognition of text from images, including scanned documents, PDFs, and photographs. The API supports multiple languages and can recognize text in various font styles and sizes. The API supports multiple languages, including English, French, German, Italian, Portuguese, and Spanish. The OCR technology used by the API is fast and accurate, allowing for quick and efficient text recognition. Overall it is a great choice for software developers to add advanced OCR functionality inside their C# applications with ease.

Previous Next

Getting Started with Free-OCR-API-CSharp

The recommend way to install Free-OCR-API-CSharp is using NuGet. Please use the following command for a smooth installation.

Install Free-OCR-API-CSharp via NuGet

 Install-Package Free-OCR-API-CSharp

You can also install it manually; download the latest release files directly from GitHub repository.

Recognize Text from Images via C# OCR API

The open source API Free-OCR-API-CSharp has included support for a great feature for recognizing text from various types of image in various languages inside .NET applications. To achieve the task software developers just need to load their image into a byte array and call the OCR method of the FreeOcrApi instance, passing in the byte array and the language of the text to recognize. The library also provides a great feature for batch recognize text from multiple files at once making it easy to process a lot of files at once. The following example shows how to recognize text from images using C# .NET code.

How to Recognize Text from Images via C# API?

using System;
using System.IO;
using FreeOcrApi;
var ocr = new FreeOcrApi("your-api-key");

// Load your image file into a byte array:
byte[] imageData = File.ReadAllBytes("path-to-your-image-file");
string recognizedText = ocr.OCR(imageData, "eng");

// Finally, display the recognized text in the console or save it to a file:
Console.WriteLine(recognizedText);
File.WriteAllText("path-to-output-file", recognizedText);

Create Searchable PDF File via C# API

The open source API Free-OCR-API-CSharp allows software developers to create searchable PDFs (also known as Sandwich PDFs) directly inside their own C# applications. By default, the added text layer is visible which gives users an great opportunity for testing the result as they can compare the OCR'ed output directly with the scan image. The following example demonstrates how software developers can load an image and convert it into search PDF documents using C# code.

How to Create Searchable PDF via C# ApI?

using System.IO;
using FreeOcrApi;
using PdfSharpCore.Drawing;
using PdfSharpCore.Pdf;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            FreeOcrApiWrapper api = new FreeOcrApiWrapper("YOUR_API_KEY");
            MemoryStream imageStream = new MemoryStream(File.ReadAllBytes("path/to/image.jpg"));
            string text = api.Recognize(imageStream);
            PdfDocument pdf = new PdfDocument();
            PdfPage page = pdf.AddPage();
            XGraphics gfx = XGraphics.FromPdfPage(page);
            XFont font = new XFont("Verdana", 12, XFontStyle.Regular);
            gfx.DrawString(text, font, XBrushes.Black, new XRect(0, 0, page.Width, page.Height), XStringFormats.TopLeft);
            pdf.Save("path/to/output.pdf");
        }
    }
}


 English