IRONSOFTWAREHOME
Read Passport
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);
Console.WriteLine(result.PassportInfo.Gender);
Console.WriteLine(result.PassportInfo.DocumentType);
Console.WriteLine(result.PassportInfo.Nationality);
Console.WriteLine(result.PassportInfo.NationalityCode);
Console.WriteLine(result.PassportInfo.IssuingCountryCode);
Console.WriteLine(result.PassportInfo.PersonalNumber);
Console.WriteLine(result.PassportInfo.DateOfIssue);
Imports IronOcr

' Instantiate OCR engine
Dim ocr As New IronTesseract()

Using inputPassport As New OcrInput()
    
    inputPassport.LoadImage("passport.jpg")
    
    ' Perform OCR
    Dim result As OcrPassportResult = 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)
    Console.WriteLine(result.PassportInfo.Gender)
    Console.WriteLine(result.PassportInfo.DocumentType)
    Console.WriteLine(result.PassportInfo.Nationality)
    Console.WriteLine(result.PassportInfo.NationalityCode)
    Console.WriteLine(result.PassportInfo.IssuingCountryCode)
    Console.WriteLine(result.PassportInfo.PersonalNumber)
    Console.WriteLine(result.PassportInfo.DateOfIssue)

End Using
NuGet Download
PM > Install-Package IronOcr
Read Passport

Read Passport

This code example demonstrates how to use the IronTesseract OCR engine to extract and process passport information from an image.

The IronTesseract OCR engine is instantiated. An OcrInput object is created to load the image containing the passport ("passport.jpg") using the LoadImage method. The ReadPassport method is used to process the image and extract passport information, returning an OcrPassportResult object that contains details like the given names, surname, country, passport number, date of birth, and date of expiry. The extracted passport information is then outputted to the console:

  • The given names are accessed through result.PassportInfo.GivenNames.
  • The country is retrieved using result.PassportInfo.Country.
  • The passport number is available via result.PassportInfo.PassportNumber.
  • The surname is accessed with result.PassportInfo.Surname.
  • The date of birth is printed using result.PassportInfo.DateOfBirth.
  • The expiry date is outputted with result.PassportInfo.DateOfExpiry.
  • The gender is accessed through result.PassportInfo.Gender.
  • The document type is retrieved using result.PassportInfo.DocumentType.
  • The nationality is available via result.PassportInfo.Nationality.
  • The nationality code is accessed with result.PassportInfo.NationalityCode.
  • The issuing country code is retrieved using result.PassportInfo.IssuingCountryCode.
  • The personal number is available via result.PassportInfo.PersonalNumber.
  • The date of issue is accessed through result.PassportInfo.DateOfIssue.
Learn to Extract Passport Info with IronOCR
View on GitHub

Ready to Get Started?

Nuget Downloads 6,279,416Version:2026.10just released

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 IronOCR
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get a Quote, No Obligation
Your details will always be kept confidential.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Trusted by Millions of Engineers Worldwide
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.10

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.10

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