Creates an instance of IOcrEngine.
public static Leadtools.Forms.Ocr.IOcrEngine CreateEngine(Leadtools.Forms.Ocr.OcrEngineType engineType,bool useThunkServer)
Public Shared Function CreateEngine( _ByVal engineType As Leadtools.Forms.Ocr.OcrEngineType, _ByVal useThunkServer As Boolean _) As Leadtools.Forms.Ocr.IOcrEngine
public static Leadtools.Forms.Ocr.IOcrEngine CreateEngine(Leadtools.Forms.Ocr.OcrEngineType engineType,bool useThunkServer)
+ (LTOcrEngine *)createEngine:(LTOcrEngineType)engineType public static OcrEngine createEngine(OcrEngineType engineType) function Leadtools.Forms.Ocr.OcrEngineManager.CreateEngine(engineType ,useThunkServer)
public:static Leadtools.Forms.Ocr.IOcrEngine^ CreateEngine(Leadtools.Forms.Ocr.OcrEngineType engineType,bool useThunkServer)
engineType
An OcrEngineType enumeration member that specifies the LEADTOOLS OCR engine type to use.
useThunkServer
This parameter is ignored since all LEADTOOLS OCR engines (Advantage, Professional, and Arabic) are now thread-safe and no longer require the "THUNK" server. Refer to Multi-Threading with LEADTOOLS OCR for more information.
The IOcrEngine instance that this method creates.
CreateEngine should be the first method your application calls into the Leadtools.Forms.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.Forms.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.Forms.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.
All LEADTOOLS OCR engines (Advantage, Professional, and Arabic) are now thread-safe and no longer require the "THUNK" server. Consequently, the
This example will use the LEADTOOLS OCR Advantage engine to OCR an image and save it as a PDF file.
using Leadtools;using Leadtools.Forms.Ocr;using Leadtools.Forms.DocumentWriters;public void CreateEngineExample(){// Create an instance of the engineusing (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false)){// Start the engine using default parametersocrEngine.Startup(null, null, null, LEAD_VARS.OcrAdvantageRuntimeDir);string tifFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif");string pdfFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.pdf");// Create an OCR documentusing (IOcrDocument ocrDocument = ocrEngine.DocumentManager.CreateDocument()){// Add a page to the documentIOcrPage 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 pageocrPage.Recognize(null);// Save the document we have as PDFocrDocument.Save(pdfFileName, DocumentFormat.Pdf, null);}// Shutdown the engine// Note: calling Dispose will also automatically shutdown the engine if it has been startedocrEngine.Shutdown();}}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";public const string OcrAdvantageRuntimeDir = @"C:\LEADTOOLS 19\Bin\Common\OcrAdvantageRuntime";}
Imports LeadtoolsImports Leadtools.Forms.OcrImports Leadtools.Forms.DocumentWriters<TestMethod>Public Sub CreateEngineExample()' Create an instance of the engineUsing ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, False)' Start the engine using default parametersocrEngine.Startup(Nothing, Nothing, Nothing, LEAD_VARS.OcrAdvantageRuntimeDir)Dim tifFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif")Dim pdfFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.pdf")' Create an OCR documentUsing ocrDocument As IOcrDocument = ocrEngine.DocumentManager.CreateDocument()' Add a page to the documentDim ocrPage As IOcrPage = ocrDocument.Pages.AddPage(tifFileName, Nothing)' Recognize the page' Note, Recognize can be called without calling AutoZone or manually adding zones. The engine will' check and automatically auto-zones the pageocrPage.Recognize(Nothing)' Save the document we have as PDFocrDocument.Save(pdfFileName, DocumentFormat.Pdf, Nothing)End Using' Shutdown the engine' Note: calling Dispose will also automatically shutdown the engine if it has been startedocrEngine.Shutdown()End UsingEnd SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"Public Const OcrAdvantageRuntimeDir As String = "C:\LEADTOOLS 19\Bin\Common\OcrAdvantageRuntime"End Class
Programming with the LEADTOOLS .NET OCR
Creating an OCR Engine Instance
Starting and Shutting Down the OCR Engine
|
Products |
Support |
Feedback: CreateEngine Method - Leadtools.Forms.Ocr |
Introduction |
Help Version 19.0.2017.6.6
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.