---
title: "Applying OCR to a PDF document | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/ocr/usage/apply-ocr-to-pdf/"
md_url: "https://www.nutrient.io/guides/dotnet/ocr/usage/apply-ocr-to-pdf.md"
last_updated: "2026-05-28T01:45:39.254Z"
description: "How to apply OCR to a PDF document using Nutrient .NET SDK."
---

# Applying OCR to a PDF document

OCR converts image-based PDFs into searchable, selectable documents. This workflow helps you process scanned files while preserving original page appearance.

Use this sample to:

- Extract text from scanned PDF pages

- Add an invisible text layer for search and copy

- Keep original layout and visual content intact

## Project setup

Install:

- The core Nutrient.NET SDK package

- `GdPicture.Resources` for OCR language and recognition resources

## Prepare the project

Register the SDK license before running OCR operations. For setup details, refer to the [getting started with.NET SDK](https://www.nutrient.io/sdk/dotnet/getting-started.md) guide.

```csharp

using GdPicture14;

LicenseManager licence = new LicenseManager();
licence.RegisterKEY(""); // Set your license key

```

## Load the PDF document

Create a `GdPicturePDF` instance and load the source PDF:

```csharp

using GdPicturePDF pdf = new GdPicturePDF();
pdf.LoadFromFile(@"input_image_based.pdf");

```

## Apply OCR processing

Run OCR across all pages:

```csharp

pdf.OcrPages("*", 0, "eng", "", "", 200);

```

Parameter summary:

- `"*"` — Process all pages

- `0` — Use default OCR mode

- `"eng"` — Use English OCR language data

- `""`, `""` — No character allowlist or denylist

- `200` — Process at 200 DPI

## Save the OCRed document

Write the processed PDF with the added text layer:

```csharp

pdf.SaveToFile(@"output.pdf");

```

The output PDF keeps its original visual content and adds searchable text for indexing, text selection, and accessibility tooling.
---

## Related pages

- [C# barcode recognition](/guides/dotnet/ocr/usage/barcode-recognition.md)
- [Converting an image to a searchable PDF in memory](/guides/dotnet/ocr/usage/image-to-searchable-pdf-in-memory.md)
- [Converting images to searchable PDFs](/guides/dotnet/ocr/usage/image-to-searchable-pdf.md)
- [C# OCR scanning to searchable PDFs](/guides/dotnet/ocr/usage/ocr-scan.md)
- [OCR PDF in C#](/guides/dotnet/ocr/usage/pdf-to-searchable-pdf.md)
- [Reading multilingual text from images](/guides/dotnet/ocr/usage/read-text-from-image-multi-language.md)
- [Convert images into searchable PDF/A files in C#](/guides/dotnet/ocr/usage/pdfa-archiving.md)
- [Reading text from images](/guides/dotnet/ocr/usage/read-text-from-image.md)

