IRONSOFTWAREHOME

How to Read Specialized Documents with C# and IronOCR

Curtis Chau
Curtis Chau
Updated: August 2, 2026

Accurately reading specific documents such as standard text documents, license plates, passports, and photos with a general singular method is very hard. These challenges stem from the diverse formats, layouts, and content of each document type, as well as variations in image quality, distortion, and specialized content. Additionally, achieving contextual understanding and balancing performance and efficiency becomes more complex with a broader scope of document types.

IronOCR introduces specific methods for performing OCR on particular documents such as standard text documents, license plates, passports, and photos to achieve optimal accuracy and performance.

Quickstart: Read a Passport in One Line

Use IronOCR's ReadPassport extension to extract all key passport details with minimal setup. With just one line of code - assuming you've installed IronOCR and AdvancedScan - you'll get structured result data like names, passport number, country, and more, fast and effortlessly.

  1. 1Install IronOCR with NuGet Package Manager

    PM > Install-Package IronOcr

  2. 2Copy and run this code snippet.

    var result = new IronTesseract().ReadPassport(new OcrInput().LoadImage("passport.jpg"));
    C#
  3. 3Deploy to test on your live environment

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

About The Package

The methods ReadLicensePlate, ReadPassport, ReadPhoto, and ReadScreenShot are extension methods to the base IronOCR package and require the IronOcr.Extensions.AdvancedScan package to be installed.

The methods work with OCR engine configurations such as blacklist and whitelist. Multiple languages, including Chinese, Japanese, Korean, and LatinAlphabet, are supported in all methods except for the ReadPassport method. Please note that each language requires an additional language package, IronOcr.Languages.

Using advanced scan on .NET Framework requires the project to run on x64 architecture. Navigate to the project configuration and uncheck the "Prefer 32-bit" option to achieve this. Learn more in the following troubleshooting guide: "Advanced Scan on .NET Framework."

Read Document Example

The ReadDocument method is a robust document reading method that specializes in scanned documents or photos of paper documents containing a lot of text. The PageSegmentationMode configuration is very important in reading text documents with different layouts.

For example, the SingleBlock and SparseText types could retrieve much information from table layout. This is because SingleBlock assumes that the text stays as a block, whereas SparseText assumes that the text is scattered throughout the document.

using IronOcr;
using System;

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

// Configure OCR engine
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.SingleBlock;

using var input = new OcrInput();

input.LoadPdf("Five.pdf");

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

Console.WriteLine(result.Text);

The methods below are extension methods to the base IronOCR package and require the IronOcr.Extensions.AdvancedScan package to be installed.

Read License Plate Example

The ReadLicensePlate method is optimized for reading license plates from photos. The special information returned from this method is the Licenseplate property, which contains the information of the license plate location in the provided document.

using IronOcr;
using IronSoftware.Drawing;
using System;

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

using var inputLicensePlate = new OcrInput();

inputLicensePlate.LoadImage("LicensePlate.jpeg");

// Perform OCR
OcrLicensePlateResult result = ocr.ReadLicensePlate(inputLicensePlate);

// Retrieve license plate coordinates
Rectangle rectangle = result.Licenseplate;

// Retrieve license plate value
string output = result.Text;

Read Passport Example

The ReadPassport method is optimized for reading and extracts passport information from passport photos by scanning the machine-readable zone (MRZ) contents. An MRZ is a specially defined zone in official documents such as passports, ID cards, and visas. The MRZ typically contains essential personal information, such as the holder's name, date of birth, nationality, and document number. Currently, this method only supports the English language.

using IronOcr;
using System;

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

using var inputPassport = new OcrInput();

inputPassport.LoadImage("Passport.jpg");

// Perform OCR
OcrPassportResult result = ocr.ReadPassport(inputPassport);

// Output passport information
Console.WriteLine(result.PassportInfo.GivenNames);
Console.WriteLine(result.PassportInfo.Country);
Console.WriteLine(result.PassportInfo.PassportNumber);
Console.WriteLine(result.PassportInfo.Surname);
Console.WriteLine(result.PassportInfo.DateOfBirth);
Console.WriteLine(result.PassportInfo.DateOfExpiry);

Result

Read Passport

Please make sure that the document only contains the passport image. Any header and footer text could confuse the method and result in an unexpected output.

Read Photo Example

The ReadPhoto method is optimized for reading images that contain hard-to-read text. This method returns the TextRegions property, which contains useful information about the detected text, such as Region, TextInRegion, and PageNumber.

using IronOcr;
using IronSoftware.Drawing;

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

using var inputPhoto = new OcrInput();
inputPhoto.LoadImageFrame("photo.tif", 2);

// Perform OCR
OcrPhotoResult result = ocr.ReadPhoto(inputPhoto);

// index number refer to region order in the page
int number = result.TextRegions[0].PageNumber;
string textinregion = result.TextRegions[0].TextInRegion;
Rectangle region = result.TextRegions[0].Region;

Read Screenshot Example

The ReadScreenShot method is optimized for reading screenshots that contain hard-to-read text. Similar to the ReadPhoto method, it also returns the TextRegions property.

using IronOcr;
using System;
using System.Linq;

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

using var inputScreenshot = new OcrInput();
inputScreenshot.LoadImage("screenshot.png");

// Perform OCR
OcrPhotoResult result = ocr.ReadScreenShot(inputScreenshot);

// Output screenshoot information
Console.WriteLine(result.Text);
Console.WriteLine(result.TextRegions.First().Region.X);
Console.WriteLine(result.TextRegions.Last().Region.Width);
Console.WriteLine(result.Confidence);

Frequently Asked Questions

What types of documents can be read using IronOCR?

IronOCR can read various document types, including standard text documents, license plates, passports, and photos. It offers specialized methods such as `ReadPassport`, `ReadLicensePlate`, `ReadPhoto`, and `ReadScreenShot` to optimize accuracy and performance for each document type.

How does IronOCR enhance reading specific document types?

IronOCR enhances reading specific document types by using tailored methods that consider diverse formats, layouts, and content types. For instance, there are dedicated functions for reading license plates and passports, which improve accuracy by focusing on relevant sections, such as machine-readable zones in passports.

Can IronOCR extract MRZ information from passports?

Yes, the `ReadPassport` method in IronOCR is specifically designed to extract information from the machine-readable zone of passport photos, providing details such as the holder's name, nationality, and passport number.

Is additional configuration required for using IronOCR on .NET Framework?

Yes, when using advanced scan features with IronOCR on .NET Framework, it's important to run the project on x64 architecture by unchecking 'Prefer 32-bit' in the project configuration.

Does IronOCR support multiple languages for OCR processes?

IronOCR supports multiple languages for OCR processes, including Chinese, Japanese, Korean, and LatinAlphabet, through additional language packages. However, the `ReadPassport` method currently supports only English.

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

The `ReadPhoto` method in IronOCR is optimized for reading images that contain hard-to-read text and provides detailed information such as text regions and page numbers for better text extraction results.

How does IronOCR handle text extraction from screenshots?

IronOCR uses the `ReadScreenShot` method to extract text from screenshots. This method is optimized to detect and provide information about text regions, allowing for effective text extraction from screen captures.

What is the purpose of the `ReadLicensePlate` method in IronOCR?

The `ReadLicensePlate` method is optimized for reading license plates from photos, allowing for extraction of license plate coordinates and values, which can be crucial for applications like traffic monitoring and vehicle recognition systems.

What precautions should be taken when using the `ReadPassport` method?

When using the `ReadPassport` method, ensure that the image only contains the passport photo to avoid confusion and unexpected output. Any additional text like headers and footers should be excluded.

How can IronOCR be installed to perform document reading in C#?

IronOCR can be installed via the NuGet package manager. Ensure that both IronOCR and IronOcr.Extensions.AdvancedScan are installed to utilize methods for reading specialized document types like license plates and passports.

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