---
title: "OCR in C#: Text, layout, and PDFs"
url: https://recursiveai.org/oneocr/articles/csharp-ocr-library/
description: "Run OCR in C# on .NET 10 with OneOcr. Choose plain text, word boxes, structured page data, or a separate PDF package for scanned documents."
date: 2026-12-01
author: OneOcr team
---

# OCR in C#: Text, layout, and PDFs

Run OCR in C# on .NET 10 with OneOcr. Choose plain text, word boxes, structured page data, or a separate PDF package for scanned documents.

December 1, 2026 · OneOcr team

[OneOcr](https://recursiveai.org/oneocr/) is a free, open-source C# OCR library from Recursive AI, licensed under [MIT or Apache-2.0](https://licenses.nuget.org/MIT%20OR%20Apache-2.0). [NuGet](https://www.nuget.org/packages/RecursiveAI.OneOcr/1.1.0) · [GitHub](https://github.com/recursive-ai-oss/oneocr-csharp)

*Install · .NET 10*

```
dotnet new console
dotnet add package RecursiveAI.OneOcr --version 1.1.0
```

Save [notice.png](https://recursiveai.org/oneocr/articles/csharp-ocr-library/notice.png) beside `Program.cs`. The OneOcr package installs OneImage as a dependency.

*Program.cs · .NET 10*

```
using OneImage;
using OneOcr;
 
var engine = OcrEngine.LoadBundled();
var page = Image.Load("notice.png").Ocr(engine);
Console.WriteLine(page.Text);
Console.WriteLine($"Words with positions: {page.Words.Count}");
```

*Output from dotnet run*

```
North entrance
Words with positions: 2
```

## Choose what to keep from the page

| Keep | How |
|---|---|
| Plain text | [`ToText`](https://recursiveai.org/oneocr/cookbook/extract-text-from-image/) returns a string in reading order for search or indexing, without word positions. |
| Page layout | [`Ocr`](https://recursiveai.org/oneocr/cookbook/page-json/) returns an `OcrPage` with word boxes, confidence, and table structure. Save as `oneocr.page` JSON to pass those details on. |
| Markdown | [Convert the page you already read](https://recursiveai.org/oneocr/cookbook/convert-scanned-page-to-markdown/) to keep inferred headings, lists, and tables without running OCR again. |

Keep the page result if someone needs to check a misread part number against the scan: the word box tells you where to look. If nobody needs that link back to the image, a plain string is usually enough.

## What ships with local OCR

The base NuGet package brings in `RecursiveAI.OneOcr.Models`. Its embedded weights provide the recognizer, page detector, and word models. `OcrEngine.LoadBundled()` loads them locally; it doesn’t fetch a model or call an OCR service. The engine runs on the CPU and can be shared across calls.

The bundled recognizer covers printed Latin (including Turkish and Vietnamese), Greek, and Cyrillic. It isn’t a handwriting recognizer. Test on scans like the ones your app will receive before treating OCR text as exact. See the [model coverage](https://recursiveai.org/oneocr/docs/overview/#why-oneocr) and [package list](https://recursiveai.org/oneocr/docs/overview/#install) for this release.

## When a PDF needs OCR

Start with text extraction if the PDF already has a usable text layer. Use [RecursiveAI.OneOcr.Pdf](https://www.nuget.org/packages/RecursiveAI.OneOcr.Pdf/1.1.0) if your input is a scan or a mix of selectable text and scanned regions. The [PDF bridge](https://recursiveai.org/oneocr/docs/pdf-bridge/) reads existing text and recognizes image regions. You don’t need the PDF package for a PNG or JPEG.

Choose [OCR a PDF](https://recursiveai.org/oneocr/cookbook/ocr-pdf/) when your app needs the recognized text or page results. Choose [make a scanned PDF searchable](https://recursiveai.org/oneocr/cookbook/make-scanned-pdf-searchable/) when the deliverable is a PDF that still looks like the scan but lets the reader select or search the words.
