IRONSOFTWAREHOME

Read Scanned Documents in C# Using IronOCR

Curtis Chau
Curtis Chau
Updated: August 2, 2026

IronOCR enables C# developers to extract text from scanned PDFs and images using OCR technology, converting non-searchable image-based documents into searchable, accessible content with just a few lines of code.

Many PDFs contain non-searchable, image-based text. IronOCR converts this into searchable content, making it easier to locate specific information and enhancing document accessibility, especially for individuals with visual impairments.

Instead of manually copying or recreating text and images, automated extraction ensures accuracy and efficiency. This is particularly useful for research, legal documents, and content creation where reusing specific portions of PDFs is common.

Businesses can extract critical data from PDFs for analysis or system integration, streamlining workflows. Designers and marketers can also extract images for enhancement and reuse in various projects.

In this tutorial, we'll explore the OcrPdfInput methods, covering the available options and parameters to showcase how IronOCR simplifies PDF text and image extraction for various applications.

To use this function, you must also install the IronOcr.Extensions.AdvancedScan package.

Quickstart: Extract Text from a Scanned PDF or Image

Get started in seconds - with one line of code you'll load your scanned PDF or image using IronOCR's OcrInput.LoadPdf or LoadImage and instantly extract the text via ReadDocument. Perfect for developers who want OCR up and running fast.

  1. 1Install IronOCR with NuGet Package Manager

    PM > Install-Package IronOcr

  2. 2Copy and run this code snippet.

    var text = new IronOcr.IronTesseract().ReadDocument(new IronOcr.OcrInput().LoadPdf("scanned.pdf")).Text;
    C#
  3. 3Deploy to test on your live environment

    Start using IronOCR in your project today with a free trial
    arrow pointer

How Do I Extract Text from Scanned Documents?

To extract text from all images within a document, use the ReadDocument method. This method processes the document and returns an object containing the extracted text, which can be accessed through the Text property. The example below demonstrates how to use this method with a sample TIFF file.

IronOCR supports a wide variety of document formats for scanning. For images, you can work with JPG, PNG, GIF, TIFF, and BMP formats, while PDF support includes both single and multi-page documents. The library uses advanced Tesseract 5 technology to ensure high accuracy across all supported formats.

Please note: - The method currently only works for English, Chinese, Japanese, Korean, and Latin Alphabet. - Using advanced scan on .NET Framework requires the project to run on x64 architecture.

What Does the Input Document Look Like?

Page from Harry Potter book showing Chapter Eight 'The Deathday Party' with narrative text about Hogwarts in October

What Do I Implement the OCR Code?

using IronOcr;
using System;

// Instantiate OCR engine
var ocr = new IronTesseract();

// Configure OCR engine
using var input = new OcrInput();
input.LoadImage("potter.tiff");

// Perform OCR
OcrResult result = ocr.ReadDocument(input);

Console.WriteLine(result.Text);

What Results Can I Expect from OCR Processing?

Visual Studio Debug window displaying OCR-processed Harry Potter text output from scanned document example

If you need to perform OCR on a PDF file instead, simply replace the LoadImage method with LoadPdf. This allows IronOCR to process and extract text from scanned PDFs in the same way.

Advanced Document Processing Options

When working with scanned documents, you often need more control over the OCR process. IronOCR provides several advanced features to enhance your text extraction results.

Processing Multi-Page Documents

For documents with multiple pages, IronOCR efficiently handles batch processing:

using IronOcr;

var ocr = new IronTesseract();
using var input = new OcrInput();

// Load a multi-page PDF
input.LoadPdf("multi-page-document.pdf");

// Process all pages
OcrResult result = ocr.ReadDocument(input);

// Access individual page results
foreach (var page in result.Pages)
{
    Console.WriteLine($"Page {page.PageNumber}: {page.WordCount} words");
}
C#

Optimizing OCR Performance

The quality of your scanned documents directly impacts OCR accuracy. IronOCR includes built-in image optimization filters to enhance text recognition:

using IronOcr;

var ocr = new IronTesseract();
using var input = new OcrInput();

// Load and enhance image quality
input.LoadImage("low-quality-scan.jpg");
input.Deskew();  // Correct image skew
input.DeNoise(); // Remove background noise
input.Binarize(); // Convert to black and white

OcrResult result = ocr.ReadDocument(input);

Creating Searchable PDFs

One of the most valuable features when processing scanned documents is the ability to create searchable PDFs. This maintains the original document appearance while adding a text layer:

using IronOcr;

var ocr = new IronTesseract();
using var input = new OcrInput();
input.LoadPdf("scanned-document.pdf");

// Process and save as searchable PDF
OcrResult result = ocr.ReadDocument(input);
result.SaveAsSearchablePdf("searchable-output.pdf");

Working with Different Document Types

IronOCR excels at processing various document types commonly encountered in business environments. Whether you're dealing with invoices, contracts, or historical documents, the library provides specialized features for extracting data from different sources.

Processing Legacy Documents

Many organizations have archives of scanned documents in older formats. IronOCR handles these efficiently, including support for multi-page TIFF files commonly used in document management systems.

Language Support

While this example focuses on English text, IronOCR supports over 125 international languages. This makes it ideal for processing multilingual documents or documents in non-English languages.

Best Practices for Document Scanning

To achieve optimal results when processing scanned documents:

  1. Scan Quality: Use a minimum resolution of 300 DPI for best results
  2. File Format: TIFF and PNG formats preserve quality better than JPEG for text documents
  3. Pre-processing: Apply appropriate filters based on your document condition
  4. Performance: For large batches, consider using multithreading capabilities

Troubleshooting Common Issues

When working with scanned documents, you might encounter various challenges. Here are solutions to common problems:

  • Poor quality scans: Apply enhancement filters before OCR processing
  • Skewed documents: Use the Deskew() method to correct orientation
  • Mixed content: Process specific regions if documents contain both text and non-text elements

For more detailed guidance, explore our comprehensive C# OCR tutorial or check out simple OCR examples to get started quickly.

Next Steps

Now that you understand how to extract text from scanned documents, you can explore more advanced features like making any PDF searchable or processing PDF streams for web applications. IronOCR's flexibility makes it suitable for everything from simple document digitization to complex enterprise document processing workflows.

Frequently Asked Questions

How can I extract text from scanned PDFs using IronOCR?

Using IronOCR, you can extract text by loading your scanned PDF using methods like `OcrInput.LoadPdf` and then calling the `ReadDocument()` method. This allows you to convert non-searchable PDFs into text-readable formats.

What image formats can IronOCR process?

IronOCR supports a variety of image formats such as JPG, PNG, GIF, TIFF, and BMP, enabling text extraction from a wide range of document types.

What is the `ReadDocument` method in IronOCR used for?

The `ReadDocument` method processes the loaded document and extracts text from all images within it, making that text accessible via the `Text` property of the resulting object.

Can IronOCR handle multi-page documents?

Yes, IronOCR can efficiently process multi-page documents, such as PDFs, by loading them with the `LoadPdf` method and extracting text from each page.

How can I enhance the quality of scanned images for better OCR results?

IronOCR includes image optimization filters like `Deskew`, `DeNoise`, and `Binarize`, which can improve OCR accuracy by correcting image skew, removing background noise, and converting images to black and white.

Does IronOCR support extracting text from documents in different languages?

IronOCR supports over 125 languages, making it adaptable for processing multilingual or non-English documents efficiently.

What does IronOCR offer for creating searchable PDFs?

With IronOCR, you can convert scanned documents into searchable PDFs by processing the document and saving it with the text layer intact, thereby maintaining its original appearance while adding search functionality.

What package is required for advanced OCR features in IronOCR?

To access advanced OCR features in IronOCR, you need to install the `IronOcr.Extensions.AdvancedScan` package, which adds additional capabilities for document processing.

What are the best practices for scanning documents for OCR processing?

For optimal OCR results, use a minimum resolution of 300 DPI, save documents in TIFF or PNG formats, apply pre-processing filters if needed, and utilize multithreading for processing large batches.

How does IronOCR handle poor quality scans?

IronOCR can improve OCR results for poor quality scans by using enhancement filters like `DeNoise` to clean up the image and `Deskew` to correct any orientation issues before processing.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Ready to Get Started?

Nuget Downloads 6,236,385Version:2026.9just released

Get your FREE

30-day Trial Key instantly.

bullet_checkedNo credit card or account creation required
bullet_testTest in production
without watermarks
bullet_calendar30 days fully
functional product
bullet_support24/5 technical
support during trial
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronOcr
nuget.org/packages/IronOcr/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronOCR"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronOCR to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronOCR.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required