Spire.OCR for .NET is a professional OCR library that supports recognizing text from Images (such as JPG, PNG, GIF, BMP, and TIFF) in both .NET Framework and .NET Core applications. In this article, we will explain how to use Spire.OCR for .NET to read text from images in .NET Framework applications.
Step 1: Create a console application (.NET Framework) in Visual Studio.
Step 2: Change the platform target of the application to X64.
In the application's solution explorer, right-click on the solution name and then click "Properties".
Change the platform target of the application to X64. This step must be performed since Spire.OCR only supports 64-bit platforms.
Step 3: Add a reference to Spire.OCR for .NET DLL in the application.
We recommend installing Spire.OCR for .NET through NuGet (Note: only Spire.OCR for .NET Version 1.8.0 or above supports working with .NET Framework). The detailed steps are as follows:
- In the application's solution explorer, right-click on the solution name or "References" and select "Manage NuGet Packages".
- Click the "Browse" tab and search for Spire.OCR.
- Click "Install" to install Spire.OCR.
Step 4: Copy DLLs from the "packages" directory to the "Debug" directory in the application.
When you install Spire.OCR through NuGet, NuGet downloads the packages and puts them in your application under a directory called "packages". You need to find the "Spire.OCR" directory under the "packages" directory, then copy the DLLs under the "Spire.OCR" directory (packages\Spire.OCR.1.8.0\runtimes\win-x64\native) to the "Debug" directory of your application.
Now you have successfully included Spire.OCR in your .NET Framework application. You can refer to the following code example to read text from images using Spire.OCR.
- C#
- VB.NET
using Spire.OCR; using System.IO; namespace OcrImage { internal class Program { static void Main(string[] args) { //Create an instance of the OcrScanner class OcrScanner scanner = new OcrScanner(); //Call the OcrScanner.Scan() method to scan text from an image scanner.Scan("image.png"); //Save the scanned text to a .txt file string text = scanner.Text.ToString(); File.WriteAllText("output.txt", text); } } }
Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.