[SerializableAttribute()]
public enum OcrEngineType
typedef NS_ENUM(NSInteger, LTOcrEngineType) {
LTOcrEngineTypeLEAD = 0
};
public enum OcrEngineType
[SerializableAttribute()]
public enum class OcrEngineType
class OcrEngineType(Enum):
LEAD = 0
OmniPage = 1
OmniPageArabic = 2
Value | Member | Description |
---|---|---|
0 | LEAD | LEAD specifies the LEADTOOLS OCR Module - LEAD Engine. Internally, the OCR library inside Leadtools.Ocr.LEADEngine.dll is used. |
Note: The LEAD OCR engine is the only engine that can be used when targeting platforms other than Windows. |
||
For more information, refer to OCR Files to be Included With Your Application. |
An OcrEngineType enumeration member is passed as a parameter to the OcrEngineManager.CreateEngine method to determine the type of engine to use. When the engine is created successfully, the engine type will be store in the IOcrEngine.EngineType property.
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
ocrPage.Recognize(null);
// 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
ocrEngine.Shutdown();
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS23\Bin\Common\OcrLEADRuntime";
}
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import leadtools.*;
import leadtools.document.writer.DocumentFormat;
import leadtools.ocr.*;
public void OcrEngineManagerCreateEngineExample() {
final String OCR_LEAD_RUNTIME_DIR = "C:\\LEADTOOLS23\\Bin\\Common\\OcrLEADRuntime";
final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";
// Create an instance of the engine
OcrEngine ocrEngine = OcrEngineManager.createEngine(OcrEngineType.LEAD);
// Start the engine using default parameters
ocrEngine.startup(null, null, null, OCR_LEAD_RUNTIME_DIR);
ILeadStream leadStream = LeadStreamFactory.create("C:\\LEADTOOLS23\\Resources\\Images\\Ocr1.tif");
String pdfFileName = combine(LEAD_VARS_IMAGES_DIR, "Ocr1.pdf");
// Create an OCR document
OcrDocument ocrDocument = ocrEngine.getDocumentManager().createDocument();
// Add a page to the document
OcrPage ocrPage = ocrDocument.getPages().addPage(leadStream, 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
ocrPage.recognize(null);
// Save the document we have as PDF
ocrDocument.save(pdfFileName, DocumentFormat.PDF, null);
assertTrue("File exists", (new File(pdfFileName)).exists());
System.out.printf("Command run, file saved to %s", pdfFileName);
// Shutdown the engine
// Note: calling Dispose will also automatically shutdown the engine if it has
// been started
ocrEngine.shutdown();
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document