TesseractOCRPdfSkiaSharp 5.5.4

dotnet add package TesseractOCRPdfSkiaSharp --version 5.5.4
                    
NuGet\Install-Package TesseractOCRPdfSkiaSharp -Version 5.5.4
                    
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="TesseractOCRPdfSkiaSharp" Version="5.5.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TesseractOCRPdfSkiaSharp" Version="5.5.4" />
                    
Directory.Packages.props
<PackageReference Include="TesseractOCRPdfSkiaSharp" />
                    
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 TesseractOCRPdfSkiaSharp --version 5.5.4
                    
#r "nuget: TesseractOCRPdfSkiaSharp, 5.5.4"
                    
#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 TesseractOCRPdfSkiaSharp@5.5.4
                    
#: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=TesseractOCRPdfSkiaSharp&version=5.5.4
                    
Install as a Cake Addin
#tool nuget:?package=TesseractOCRPdfSkiaSharp&version=5.5.4
                    
Install as a Cake Tool

TesseractOCRPdfSkiaSharp

Optional PDF input for TesseractOCR.Engine and TesseractOCR.EnginePool. This package replaces TesseractOCRPdf and retains its TesseractOCRPdf namespace.

dotnet add package TesseractOCRPdfSkiaSharp
dotnet add package TesseractOCR.Languages.English
using System;
using System.IO;
using TesseractOCR;
using TesseractOCR.Enums;
using TesseractOCRPdf;

var dataPath = Path.Combine(AppContext.BaseDirectory, "tessdata");
using var engine = new Engine(dataPath, Language.English);
var pages = engine.ProcessPdf("invoice.pdf");
foreach (var text in pages)
	Console.WriteLine(text);

using var pool = new EnginePool(dataPath, Language.English, maximumEngines: 2);
using var stream = File.OpenRead("invoice.pdf");
var pooledPages = await pool.ProcessPdfAsync(stream, dpi: 300);

Both methods accept a filename, byte[], or readable, seekable Stream. Results contain one plain-text entry per page (including blank pages), in PDF order. All pages are rasterized and OCR'd, even when a PDF already contains selectable text. Optional arguments: dpi (positive, default 300), pageSegMode, password for encrypted PDFs, and cancellationToken. Invalid PDFs, wrong passwords, I/O and native dependency failures propagate as exceptions, not empty results. Streams remain open, are read from the beginning, and may have their position changed. Do not modify input bytes or streams during processing.

For image preprocessing, layout, confidence or other OCR output, render pages yourself:

foreach (var image in PdfImage.RenderPages("invoice.pdf", dpi: 300))
{
	using (image)
	using (var page = engine.Process(image))
		Console.WriteLine($"{page.MeanConfidence}: {page.Text}");
}

Dispose every rendered Pix.Image. Enumeration is lazy; keep input streams open and dispose the enumerator when stopping early (foreach does this automatically). Extension methods dispose all their own images and OCR pages, never the caller's engine, pool or stream. Only one page image is retained at a time; text results are collected in memory. Do not use an Engine concurrently. Multiple documents can share an EnginePool from separate workers, but each document processes its pages sequentially. Waiting for pool capacity is asynchronous; rendering and OCR execute synchronously on the calling worker. Cancellation is checked between native operations and while waiting for pool capacity; it cannot interrupt native rendering or OCR already in progress.

Dependencies and platforms

SkiaSharp cannot read/render PDF documents by itself. This package uses PDFtoImage (MIT), which renders with PDFium and returns SkiaSharp bitmaps. Pages are composited on white, including annotations and form values, converted losslessly in memory to Pix.Image, and given the requested DPI. No temporary image files or System.Drawing.Common are used. PDFium serializes native rendering within a process; an engine pool does not make PDF rendering parallel.

The package targets .NET Framework 4.8 and .NET Standard 2.1 (.NET Core 3.0+ / modern .NET). PDFtoImage supplies its PDFium and SkiaSharp native runtime dependencies transitively. Actual platform support is the intersection with TesseractOCR: bundled OCR binaries support Windows x86/x64/ARM64 and glibc Linux x64/ARM64. See the main repository README for Tesseract native runtime prerequisites and language data. macOS requires separately supplied compatible Tesseract/Leptonica binaries and is not verified here.

Installing only TesseractOCR does not bring in PDFtoImage, PDFium or SkiaSharp. These dependencies are confined to this optional package. This package requires TesseractOCR 5.5.3 or later, which includes EnginePool; publish the updated core package before the PDF package. From the repository root, build both packages with:

dotnet pack TesseractOCR\TesseractOCR.csproj -c Release -p:GeneratePackageOnBuild=false
dotnet pack TesseractOCRPdfSkiaSharp\TesseractOCRPdfSkiaSharp.csproj -c Release -p:GeneratePackageOnBuild=false

Run PDF regression tests with dotnet test TesseractOCRPdf.Tests\TesseractOCRPdf.Tests.csproj -c Release. The test project targets .NET 10; packing the library builds both .NET Framework 4.8 and .NET Standard 2.1 assemblies.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
5.5.4 102 11/26/2026

Adds PDF support for TesseractOCR