SoftZenPdf.Ocr 1.1.0

dotnet add package SoftZenPdf.Ocr --version 1.1.0
                    
NuGet\Install-Package SoftZenPdf.Ocr -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SoftZenPdf.Ocr" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SoftZenPdf.Ocr" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="SoftZenPdf.Ocr" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SoftZenPdf.Ocr --version 1.1.0
                    
#r "nuget: SoftZenPdf.Ocr, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SoftZenPdf.Ocr@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SoftZenPdf.Ocr&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=SoftZenPdf.Ocr&version=1.1.0
                    
Install as a Cake Tool

SoftZenPdf.Ocr

OCR for SoftZenPdf with the Tesseract 5 engine: recognise the text in scanned images and PDFs, turn scans into searchable PDFs and PDF/A-2b archives, and make existing scanned PDFs searchable.

dotnet add package SoftZenPdf.Ocr

Requires .NET 8 or later. Brings in SoftZenPdf (the same version) and the Tesseract wrapper, which includes the native Tesseract and Leptonica libraries for Windows x64 and x86.

Language data

Tesseract needs a .traineddata file for each language. Download them once and ship them with your application:

using SoftZenPdf;
using SoftZenPdf.Ocr;

using var engine = new TesseractOcrEngine(new TesseractOcrOptions
{
    TessDataPath = "tessdata",   // the folder holding eng.traineddata
    Languages = ["eng"],
});

Words with positions

OcrPage page = engine.Recognize(PdfImage.FromFile("invoice.png"));

foreach (var line in page.Lines)
    Console.WriteLine(line.Text);

var total = page.Words.First(w => w.Text == "3,944.00");
Console.WriteLine($"{total.Bounds} {total.Confidence:0}%");

Accepts JPEG, PNG, GIF, BMP and TIFF (every page), with EXIF and TIFF orientation applied. Results have paragraphs, lines and words with pixel boxes, baselines and confidence.

Searchable PDFs

var creator = new OcrPdfCreator(engine);
creator.CreatePdf(["invoice.png", "scan.tif"], "searchable.pdf");

Each page shows the scan, with the recognised words laid invisibly over it, word by word, so search, selection and copy match what you see. The text layer uses a built-in embedded font that accepts every script.

For archiving, create PDF/A-2b instead:

var archive = new OcrPdfCreator(engine, new OcrPdfOptions { Conformance = PdfAConformance.PdfA2b });
archive.CreatePdf(["invoice.png"], "invoice-archive.pdf");

Existing scanned PDFs

var result = creator.AddTextLayer("from-the-copier.pdf", "searchable.pdf");
foreach (var warning in result.Warnings) Console.WriteLine(warning);

The text is appended as an incremental update, so the original file, its scans, bookmarks and metadata are kept byte for byte, and a PDF/A file stays PDF/A. Sideways and rotated scans are read upright, and pages that already have text are left alone.

Platforms

  • Windows x64 and x86: works out of the box.
  • Linux x64: install Tesseract 5 and Leptonica from your distribution (for example apt install libtesseract5 liblept5). The wrapper looks for them in an x64 folder next to your application as libtesseract50.so and libleptonica-1.82.0.so, so link them there.
  • macOS: not supported.

Limits

  • In existing PDFs, JBIG2 and JPEG 2000 images cannot be decoded, and only the largest image on each page is recognised.
  • No automatic deskew or clean-up of the scans before recognition.
  • Right-to-left text may copy in reverse order in some viewers.

Documentation and licensing

Guide: https://pdf.softzensystems.com/docs/guides/ocr
API reference: https://pdf.softzensystems.com/api/

SoftZenPdf.Ocr is commercial software covered by your SoftZenPdf license, with a free Community license for individuals and organisations under US$1 million annual revenue; see https://pdf.softzensystems.com/pricing. Without a license key, saved pages carry an evaluation mark and plain text (OcrPage.Text, RecognizeText) starts with an evaluation notice line; words, positions and confidence are unchanged. Tesseract and its language data are Apache 2.0 licensed.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 136 10/2/2026

First release: Tesseract 5 OCR, searchable PDFs and PDF/A-2b from images, and text layers for existing scanned PDFs. Full notes: https://pdf.softzensystems.com/changelog