←Select platform

CreateEngine Method

Creates an instance of IOcrEngine.
public static IOcrEngine CreateEngine( 
   OcrEngineType engineType 
+ (LTOcrEngine *)createEngine:(LTOcrEngineType)engineType 
public static OcrEngine createEngine(OcrEngineType engineType) 
   static IOcrEngine^ CreateEngine( 
      OcrEngineType^ engineType 


An OcrEngineType enumeration member that specifies the LEADTOOLS OCR engine type to use.

Return Value

The IOcrEngine instance that this method creates.


CreateEngine should be the first method your application calls into the Leadtools.Ocr assembly. Afterwards, you can use the properties and methods of this interface to perform your OCR tasks.

Based on the engine type passed to the CreateEngine methods, OcrEngineManager will load the OCR engine defined in one of the supporting assemblies and return an interface to IOcrEngine. Use this interface and its included types to start using the Leadtools.Ocr class library. For more information about the engine types, refer to OcrEngineType.

The CreateEngine method lets you create an instance of IOcrEngine, loading the corresponding Leadtools.Ocr.[EngineName].dll assembly using the .NET System.Reflection.Assembly.Load(string assemblyString) method. You cannot unload this assembly once it has been successfully loaded.

The LEADTOOLS OCR Module - LEAD Engine is now thread-safe and no longer require the "THUNK" server.


This example will use the LEADTOOLS OCR Module - LEAD Engine to OCR an image and save it as a PDF file.

using Leadtools; 
using Leadtools.Ocr; 
using Leadtools.Document.Writer; 
using Leadtools.Codecs; 
public void CreateEngineExample() 
   // Create an instance of the engine 
   using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD)) 
      // Start the engine using default parameters 
      ocrEngine.Startup(null, null, null, LEAD_VARS.OcrLEADRuntimeDir); 
      string tifFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif"); 
      string pdfFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.pdf"); 
      // Create an OCR document 
      using (IOcrDocument ocrDocument = ocrEngine.DocumentManager.CreateDocument()) 
         // Add a page to the document 
         IOcrPage ocrPage = ocrDocument.Pages.AddPage(tifFileName, null); 
         // Recognize the page 
         // Note, Recognize can be called without calling AutoZone or manually adding zones. The engine will 
         // check and automatically auto-zones the page 
         // Save the document we have as PDF 
         ocrDocument.Save(pdfFileName, DocumentFormat.Pdf, null); 
      // Shutdown the engine 
      // Note: calling Dispose will also automatically shutdown the engine if it has been started 
static class LEAD_VARS 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
   public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS22\Bin\Common\OcrLEADRuntime"; 

Target Platforms

Help Version 22.0.2023.2.4
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Ocr Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.