# OCREngine Class

> Represents an OCR Engine and its configuration.

- Product: Adobe PDF Library 21
- Language: .NET Framework
- Version: APDFL21.0.0PlusP1e
- HTML page: https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/OCREngine
- Version index: https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/llms.txt

```csharp
class OCREngine : SystemIDisposable
```

**Namespace:** `Datalogics::PDFL`

**Inherits from:** `SystemIDisposable`

## Description

Represents an OCR Engine and its configuration.

Create an OCREngine object once, and reuse it to convert multiple images to Form objects to avoid repeating the sometimes expensive initialization of the engine. The configuration of the engine can't be changed after it's created; if you need to do that, create another OCREngine object.

**Referenced by:** [`Page`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Page.md)

**Uses types:** [`Document`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Document.md), [`Form`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Form.md), [`Image`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Image.md), [`Language`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/Language.md), [`MissingFontStrategy`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/MissingFontStrategy.md), [`OCRParams`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/OCRParams.md)

## Constructors

### OCREngine

```csharp
Datalogics.PDFL.OCREngine.OCREngine()
```

*constructor*

Create an OCR engine.

### OCREngine

```csharp
Datalogics.PDFL.OCREngine.OCREngine(OCRParams ocrParams)
```

*constructor*

**Parameters**

- `ocrParams` ([`OCRParams`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/OCRParams.md)): the configuration to use

Create an OCR engine with a specified configuration.

## Properties

### AvailableLanguages

```csharp
System.Collections.Generic.IList<Language> Datalogics.PDFL.OCREngine.AvailableLanguages { get; }
```

Get a list of languages this OCREngine can use.

## Methods

### Dispose

```csharp
void Datalogics.PDFL.OCREngine.Dispose()
```

**Returns:** `void`

### IsLanguageAvailable

```csharp
bool Datalogics.PDFL.OCREngine.IsLanguageAvailable(Language language)
```

**Parameters**

- `language` ([`Language`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/Language.md)): the language to check

**Returns:** `bool`

true if the language is available, false otherwise

Query if a language for OCR is available for use.

### PlaceTextUnder

```csharp
Form Datalogics.PDFL.OCREngine.PlaceTextUnder(Image image)
```

**Parameters**

- `image` ([`Image`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Image.md)): The image in which to recognize text.

**Returns:** [`Form`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Form.md)

a Form element containing the image with text underneath.

Recognize text in the image, returning a form element with the image and the text underneath.

Run the image through an OCR engine. Creates a Form element containing the image, and additional text underneath. The Form element has a transformation matrix which makes it directly substitutable for the image in a Content stream.

This method may throw an exception if it can't find a font that will represent all the characters in a word. See the candidateFontNames on OCRParams to supply more fonts.

### PlaceTextUnder

```csharp
Form Datalogics.PDFL.OCREngine.PlaceTextUnder(Image image, Document inDocument)
```

**Parameters**

- `image` ([`Image`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Image.md)): The image in which to recognize text.
- `inDocument` ([`Document`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Document.md)): The destination document for the created form.

**Returns:** [`Form`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Form.md)

a Form element containing the image with text underneath.

Recognize text in the image, returning a form element with the image and the text underneath.

Run the image through an OCR engine. Creates a Form element containing the image, and additional text underneath. The Form element has a transformation matrix which makes it directly substitutable for the image in a Content stream.

The form will be created in the specified document, sharing fonts with the results of recognizing text in other images.

This method may throw an exception if it can't find a font that will represent all the characters in a word. See the candidateFontNames on OCRParams to supply more fonts.

### PlaceTextUnder

```csharp
Form Datalogics.PDFL.OCREngine.PlaceTextUnder(Image image, Document inDocument, double resolution)
```

**Parameters**

- `image` ([`Image`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Image.md)): The image in which to recognize text.
- `inDocument` ([`Document`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Document.md)): The destination document for the created form.
- `resolution` (`double`): The resolution of the Image being recognized.

**Returns:** [`Form`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Form.md)

a Form element containing the image with text underneath.

Recognize text in the image of the known resolution, returning a form element with the image and the text underneath. Knowing the image's resolution can enhance recognition.

NOTE: Determining the resolution of the image is the caller's responsibility.

Run the image through an OCR engine. Creates a Form element containing the image, and additional text underneath. The Form element has a transformation matrix which makes it directly substitutable for the image in a Content stream.

The form will be created in the specified document, sharing fonts with the results of recognizing text in other images.

If a font that will represent all the characters in a word can't be found, an exception will be raised.

### PlaceTextUnder

```csharp
Form Datalogics.PDFL.OCREngine.PlaceTextUnder(Image image, Document inDocument, double resolution, MissingFontStrategy missingFontStrategy)
```

**Parameters**

- `image` ([`Image`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Image.md)): The image in which to recognize text.
- `inDocument` ([`Document`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Document.md)): The destination document for the created form.
- `resolution` (`double`): The resolution of the Image being recognized.
- `missingFontStrategy` ([`MissingFontStrategy`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/MissingFontStrategy.md)): The behavior to use if a Font can't be found to represent the recognized text.

**Returns:** [`Form`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Form.md)

a Form element containing the image with text underneath.

Recognize text in the image of the known resolution, returning a form element with the image and the text underneath. Knowing the image's resolution can enhance recognition.

NOTE: Determining the resolution of the image is the caller's responsibility.

Run the image through an OCR engine. Creates a Form element containing the image, and additional text underneath. The Form element has a transformation matrix which makes it directly substitutable for the image in a Content stream.

The form will be created in the specified document, sharing fonts with the results of recognizing text in other images.

If a font that will represent all the characters in a word can't be found, the missingFontStrategy will determine the behavior to employ.

### PlaceTextUnder

```csharp
Form Datalogics.PDFL.OCREngine.PlaceTextUnder(Image image, Document inDocument, MissingFontStrategy missingFontStrategy)
```

**Parameters**

- `image` ([`Image`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Image.md)): The image in which to recognize text.
- `inDocument` ([`Document`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Document.md)): The destination document for the created form.
- `missingFontStrategy` ([`MissingFontStrategy`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/MissingFontStrategy.md)): The behavior to use if a Font can't be found to represent the recognized text.

**Returns:** [`Form`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Form.md)

a Form element containing the image with text underneath.

Recognize text in the image, returning a form element with the image and the text underneath. Knowing the image's resolution can enhance recognition.

Run the image through an OCR engine. Creates a Form element containing the image, and additional text underneath. The Form element has a transformation matrix which makes it directly substitutable for the image in a Content stream.

The form will be created in the specified document, sharing fonts with the results of recognizing text in other images.

If a font that will represent all the characters in a word can't be found, the missingFontStrategy will determine the behavior to employ.
