OCRSettings Class
A class containing the settings of the OCR process.
Inheritance
Namespace: Syncfusion.OCRProcessor
Assembly: Syncfusion.OCRProcessor.Base.dll
Syntax
public class OCRSettings : Object
Constructors
OCRSettings()
Declaration
public OCRSettings()
Properties
BlackList
Gets or sets the BlackList values.
Declaration
public string BlackList { get; set; }
Property Value
| Type |
|---|
| System.String |
Conformance
Gets or sets the PDF conformance level.
Declaration
public PdfConformanceLevel Conformance { get; set; }
Property Value
| Type | Description |
|---|---|
| PdfConformanceLevel | The PdfConformanceLevel ENUM. |
Remarks
This PDF conformance option is only applicable for Image OCR to PDF document.
Examples
// Initialize the OCR processor.
OCRProcessor processor = new OCRProcessor();
//loading the input image.
FileStream stream = new FileStream(@"Input.jpeg ", FileMode.Open);
Bitmap image = new Bitmap(stream);
// Set OCR language to process.
processor.Settings.Language = Languages.English;
FileStream fontStream = new FileStream(@"ARIALUNI.ttf", FileMode.Open);
processor.UnicodeFont = new PdfTrueTypeFont(fontStream, true, PdfFontStyle.Regular, 10);
processor.Settings.Conformance = PdfConformanceLevel.Pdf_A1B;
processor.TesseractPath = TesseractBinariesPath;
processor.TessDataPath = TessdataPath;
PdfDocument document = processor.PerformOCR(image);
document.Save("Output.pdf");
document.Close(true);
ImageEnhancementOptions
Gets or sets the options used for image enhancement during OCR processing.
Declaration
public OcrImageEnhancementOptions ImageEnhancementOptions { get; set; }
Property Value
| Type |
|---|
| OcrImageEnhancementOptions |
IsCompressionEnabled
Gets or sets the compression of TIFF image.
Declaration
public bool IsCompressionEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
IsImageStraighteningEnabled
Gets or sets the StraightenImage.
Declaration
public bool IsImageStraighteningEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
IsRegionMarked
Gets or sets the Region marked.
Declaration
public bool IsRegionMarked { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Language
Gets or sets the OCR language.
Declaration
public string Language { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The language to be OCRed |
OCREngineMode
Gets or sets OCR Engine Mode.
Declaration
public OCREngineMode OCREngineMode { get; set; }
Property Value
| Type |
|---|
| OCREngineMode |
Remarks
OCREngineMode only supported in Tesseract version 4.0
PageSegment
Gets or sets the Page Segment Mode.
Declaration
public PageSegMode PageSegment { get; set; }
Property Value
| Type |
|---|
| PageSegMode |
Paginate
Gets or sets the pagination of the images.
Declaration
public bool Paginate { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Regions
Gets or sets the regions to process OCR.
Declaration
public List<PageRegion> Regions { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<PageRegion> | Collection of page regions to apply OCR |
TempFolder
Declaration
public string TempFolder { set; }
Property Value
| Type |
|---|
| System.String |
TesseractVersion
To set or get the custom Tesseract version for OCR Processor.
using (OCRProcessor processor = new OCRProcessor(@"TesseractBinaries\"))
{
//Load a PDF document
PdfLoadedDocument lDoc = new PdfLoadedDocument("Input.pdf");
//Set OCR language to process
processor.Settings.Language = Languages.English;
//set the OCR Processing engine version.
processor.Settings.TesseractVersion = TesseractVersion.Default;
//Process OCR by providing the PDF document and Tesseract data
processor.PerformOCR(lDoc, @"TessData\");
//Save the OCR processed PDF document in the disk
lDoc.Save("Sample.pdf");
lDoc.Close(true);
}
Declaration
public TesseractVersion TesseractVersion { get; set; }
Property Value
| Type |
|---|
| TesseractVersion |
WhiteList
Gets or sets the WhiteList values.
Declaration
public string WhiteList { get; set; }
Property Value
| Type |
|---|
| System.String |