# TesseractOcrEngineOptions class

> Settings for TesseractOcrEngine. TesseractOcrEngineOptions class, PdfNetStack.Ocr.Tesseract namespace.

Namespace: [PdfNetStack.Ocr.Tesseract](https://www.jadev-corp.com/api/pdfnetstack-ocr-tesseract/)  
Assembly: PdfNetStack.Ocr.Tesseract.dll  
Package: `PdfNetStack`

Settings for [TesseractOcrEngine](https://www.jadev-corp.com/api/pdfnetstack-ocr-tesseract/tesseractocrengine/).

```csharp
public sealed class TesseractOcrEngineOptions
```

**Inheritance**

[object](https://learn.microsoft.com/dotnet/api/system.object) ← 
[TesseractOcrEngineOptions](https://www.jadev-corp.com/api/pdfnetstack-ocr-tesseract/tesseractocrengineoptions/)

## Properties

### <a id="PdfNetStack_Ocr_Tesseract_TesseractOcrEngineOptions_Dpi"></a> Dpi

The resolution to tell Tesseract about. Null lets it estimate one from the text, as the images come from pages of any resolution.

```csharp
public int? Dpi { get; init; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)?

### <a id="PdfNetStack_Ocr_Tesseract_TesseractOcrEngineOptions_ExecutablePath"></a> ExecutablePath

The tesseract executable. Null looks for it in the absolute folders of the PATH, never in the
current folder. Name the program itself rather than a script around it: on .NET Framework a
timeout or cancellation kills only the process started, so anything it started keeps running.
.NET 8 and later kill the whole tree.

```csharp
public string? ExecutablePath { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="PdfNetStack_Ocr_Tesseract_TesseractOcrEngineOptions_LanguageMap"></a> LanguageMap

What a requested language means to Tesseract. By default <code>latin</code> is <code>eng</code> and
<code>arabic</code> is <code>ara</code>, so that [PdfOcrOptions](https://www.jadev-corp.com/api/pdfnetstack-ocr/pdfocroptions/) works unchanged. A name not
listed here goes to Tesseract as it is.

```csharp
public IReadOnlyDictionary<string, string> LanguageMap { get; init; }
```

#### Property Value

 [IReadOnlyDictionary](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlydictionary\-2)<[string](https://learn.microsoft.com/dotnet/api/system.string), [string](https://learn.microsoft.com/dotnet/api/system.string)\>

### <a id="PdfNetStack_Ocr_Tesseract_TesseractOcrEngineOptions_Languages"></a> Languages

The languages to check for when loading, as they will be requested: the names in
[LanguageMap](https://www.jadev-corp.com/api/pdfnetstack-ocr-tesseract/tesseractocrengineoptions/#PdfNetStack_Ocr_Tesseract_TesseractOcrEngineOptions_LanguageMap) or Tesseract's own, such as <code>fra</code> or <code>eng+ara</code>.
Loading fails when the data for one is missing.

```csharp
public IReadOnlyList<string> Languages { get; init; }
```

#### Property Value

 [IReadOnlyList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist\-1)<[string](https://learn.microsoft.com/dotnet/api/system.string)\>

### <a id="PdfNetStack_Ocr_Tesseract_TesseractOcrEngineOptions_MaxConcurrentProcesses"></a> MaxConcurrentProcesses

Processes running at once; further calls wait their turn. Each process holds the image and the language data in memory.

```csharp
public int MaxConcurrentProcesses { get; init; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="PdfNetStack_Ocr_Tesseract_TesseractOcrEngineOptions_MaxOutputBytes"></a> MaxOutputBytes

The output one image may produce before its process is killed and [TesseractOcrException](https://www.jadev-corp.com/api/pdfnetstack-ocr-tesseract/tesseractocrexception/) is thrown.

```csharp
public long MaxOutputBytes { get; init; }
```

#### Property Value

 [long](https://learn.microsoft.com/dotnet/api/system.int64)

### <a id="PdfNetStack_Ocr_Tesseract_TesseractOcrEngineOptions_PageSegmentationMode"></a> PageSegmentationMode

Tesseract's page segmentation mode: 3 is automatic layout without orientation detection. 0 and 2 give no text and are refused.

```csharp
public int PageSegmentationMode { get; init; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="PdfNetStack_Ocr_Tesseract_TesseractOcrEngineOptions_TessdataPath"></a> TessdataPath

The folder holding the <code>.traineddata</code> files. Null leaves it to Tesseract: <code>TESSDATA_PREFIX</code>, else where it was installed.

```csharp
public string? TessdataPath { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="PdfNetStack_Ocr_Tesseract_TesseractOcrEngineOptions_ThreadsPerProcess"></a> ThreadsPerProcess

Threads each process may use, through <code>OMP_THREAD_LIMIT</code>. The default of 1 suits
[PdfOcr](https://www.jadev-corp.com/api/pdfnetstack-ocr/pdfocr/), which already reads pages in parallel. 0 leaves it to Tesseract.

```csharp
public int ThreadsPerProcess { get; init; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="PdfNetStack_Ocr_Tesseract_TesseractOcrEngineOptions_Timeout"></a> Timeout

The time one image may take before its process is killed and `TimeoutException` is thrown.

```csharp
public TimeSpan Timeout { get; init; }
```

#### Property Value

 [TimeSpan](https://learn.microsoft.com/dotnet/api/system.timespan)

## Used in

- [Make scanned PDFs searchable with OCR in C#](https://www.jadev-corp.com/guides/ocr/)

Source: https://www.jadev-corp.com/pdfnetstack/api/pdfnetstack-ocr-tesseract/tesseractocrengineoptions/
