---
title: "Applying OCR to a PDF page | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/csharp/extraction/apply-ocr-to-pdf-page/"
md_url: "https://www.nutrient.io/guides/dotnet/csharp/extraction/apply-ocr-to-pdf-page.md"
last_updated: "2026-10-08T00:00:00.000Z"
description: "How to run OCR on a single PDF page using Nutrient .NET SDK."
---

# Applying OCR to a PDF page

Running OCR on a single page is useful when only part of a document needs recognition, or when pages are processed on demand as a larger workflow progresses. Examples include scanning the cover page of a batch to extract a reference number, applying OCR only to pages flagged during triage, or incrementally processing a long document without reprocessing pages that are already searchable.

Applying OCR at the page level adds an invisible text layer to just that page. The rest of the document is untouched, so the operation is fast and idempotent per page.

This sample shows how to run OCR on a single page of a document using Nutrient.NET SDK and save the result. The input can be any document format the SDK supports, such as an image-based PDF, a multi-page TIFF, or a single image. If the input isn't already a PDF, the SDK converts it to PDF automatically when you create the editor.

[Download sample](https://www.nutrient.io/downloads/samples/csharp/apply-ocr-to-pdf-page.zip)

## How Nutrient helps

Nutrient.NET SDK exposes the same OCR pipeline at the page level. Behind a single method call the SDK:

- Implicitly converts non-PDF inputs (images, multi-page TIFFs, Office documents) to PDF when the editor is created

- Renders just the target page to a bitmap at the resolution OCR needs

- Runs text recognition with the configured languages

- Preserves reading order and text block orientation returned by the recognizer

- Places an invisible, correctly positioned text layer over the original page content

Other pages in the document aren't touched.

## Preparing the project

Import the Nutrient namespace:

```csharp

using Nutrient;

```

## Running OCR on a single page

Open the source document inside a [using statement](https://learn.microsoft.com/dotnet/csharp/language-reference/statements/using), configure the OCR language, then run OCR only on the first page. The sample passes an image-based PDF as input, but the same code handles raw images or any other supported document format. The `using` statements close the document and editor automatically when the block ends, even if an error is thrown:

```csharp

try
{
    using Document document = Document.Open("input_image_based.pdf");
    document.Settings.OcrSettings.DefaultLanguages = "eng";

    using PdfEditor editor = PdfEditor.Edit(document);
    PdfPageCollection pages = editor.PageCollection;

    PdfPage page = pages.First?? throw new InvalidOperationException("The document has no pages.");
    page.MakeSearchable();

```

Setting `DefaultLanguages` to `"eng"` tells the recognizer which language models to load. Combine languages with `+` (for example `"eng+deu"`) when the page contains more than one language.

`PdfEditor.Edit(document)` attaches an editor to the open document. If the input isn't already a PDF, the SDK converts it to PDF at this step. `editor.PageCollection.First` then returns the first page of the resulting PDF as a `PdfPage`. Calling `page.MakeSearchable()` runs OCR on that page and writes an invisible text layer on top of it. Any hidden text already present on the page is removed before the new layer is drawn. Other pages in the document are left unchanged.

To target a different page, call `GetPage` with the 1-based page number (for example `pages.GetPage(3)` for the third page) and call `MakeSearchable()` on that page instead.

## Saving the result

Save the modified document to a new file. Wrap the workflow in `try/catch` on `NutrientException` to surface any licensing, language-pack, or I/O issue that the SDK reports:

```csharp

    editor.SaveAs("output.pdf");
    Console.WriteLine("Successfully applied OCR to the first page of output.pdf");
}
catch (NutrientException e)
{
    Console.Error.WriteLine($"Error: {e.Message}");
    Environment.Exit(1);
}

```

## Conclusion

The workflow for OCR-ing a single PDF page is:

1. Open the source document.

2. Configure OCR languages on the document settings.

3. Create a `PdfEditor` for the document.

4. Get the target page from `editor.PageCollection`.

5. Call `MakeSearchable()` on that page.

6. Save the result — the `using` statements release the editor and document.

Only the targeted page gains the invisible text layer. The rest of the document is bit-for-bit identical to the input.
---

## Related pages

- [Nutrient .NET SDK extraction guides](/guides/dotnet/csharp/extraction.md)
- [Applying OCR to a PDF document](/guides/dotnet/csharp/extraction/apply-ocr-to-pdf.md)
- [Classifying documents](/guides/dotnet/csharp/extraction/classify-document.md)
- [Generating image descriptions using Claude](/guides/dotnet/csharp/extraction/describe-image-with-claude.md)
- [Generating image descriptions using local AI](/guides/dotnet/csharp/extraction/describe-image-with-local-ai.md)
- [Generating image descriptions using OpenAI](/guides/dotnet/csharp/extraction/describe-image-with-openai.md)
- [Detecting document language](/guides/dotnet/csharp/extraction/detect-document-language.md)
- [Extracting data from images using ICR](/guides/dotnet/csharp/extraction/extract-data-from-image-icr.md)
- [Extracting data from images using OCR](/guides/dotnet/csharp/extraction/extract-data-from-image-ocr.md)
- [Extracting data from images using vision language models](/guides/dotnet/csharp/extraction/extract-data-from-image-vlm.md)
- [Extracting data from specific pages](/guides/dotnet/csharp/extraction/extract-data-from-specific-pages.md)
- [Extracting form fields from images](/guides/dotnet/csharp/extraction/extract-form-fields-from-image.md)
- [Extracting structured data from documents](/guides/dotnet/csharp/extraction/extract-structured-data.md)
- [Generating extraction schemas](/guides/dotnet/csharp/extraction/generate-extraction-schema.md)
- [Extracting JSON data from a PDF document](/guides/dotnet/csharp/extraction/json-data-extraction.md)
- [Labeling form fields with a vision language model](/guides/dotnet/csharp/extraction/label-form-fields-with-vlm.md)
- [Parsing a document into structured content](/guides/dotnet/csharp/extraction/parse-document.md)
- [Extracting text from PDF documents](/guides/dotnet/csharp/extraction/pdf-to-text.md)
- [Reading barcodes with vision extraction](/guides/dotnet/csharp/extraction/read-barcodes-with-vision.md)
- [Extracting text from multilingual images](/guides/dotnet/csharp/extraction/read-text-from-image-multi-language.md)
- [Extracting text from images](/guides/dotnet/csharp/extraction/read-text-from-image.md)
- [Searching document text](/guides/dotnet/csharp/extraction/search-document-text.md)
- [Speeding up first ICR operation by predownloading models](/guides/dotnet/csharp/extraction/speed-up-first-icr-by-downloading-requirements.md)

