TesseractOCRPdfImageMagick 5.5.4
dotnet add package TesseractOCRPdfImageMagick --version 5.5.4
NuGet\Install-Package TesseractOCRPdfImageMagick -Version 5.5.4
<PackageReference Include="TesseractOCRPdfImageMagick" Version="5.5.4" />
<PackageVersion Include="TesseractOCRPdfImageMagick" Version="5.5.4" />
<PackageReference Include="TesseractOCRPdfImageMagick" />
paket add TesseractOCRPdfImageMagick --version 5.5.4
#r "nuget: TesseractOCRPdfImageMagick, 5.5.4"
#:package TesseractOCRPdfImageMagick@5.5.4
#addin nuget:?package=TesseractOCRPdfImageMagick&version=5.5.4
#tool nuget:?package=TesseractOCRPdfImageMagick&version=5.5.4
TesseractOCRPdfImageMagick
Optional PDF input for TesseractOCR.Engine and TesseractOCR.EnginePool, rendered with ImageMagick and Ghostscript.
dotnet add package TesseractOCRPdfImageMagick
dotnet add package TesseractOCR.Languages.English
using System;
using System.IO;
using TesseractOCR;
using TesseractOCR.Enums;
using TesseractOCRPdfImageMagick;
var dataPath = Path.Combine(AppContext.BaseDirectory, "tessdata");
using var engine = new Engine(dataPath, Language.English);
var pages = engine.ProcessPdf("invoice.pdf", dpi: 300);
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);
Both methods accept a filename, byte[], or readable, seekable Stream. They return one text entry per page, including blank pages, in document order. All pages are rasterized and OCR'd, even when a PDF contains selectable text. Optional arguments include positive dpi (default 300), pageSegMode, password, and cancellationToken. Invalid PDFs, incorrect passwords, I/O errors, and native dependency failures propagate as exceptions. Streams remain open, are read from the beginning, and may have their position changed. Do not modify input bytes or streams during processing.
For preprocessing or other OCR outputs, use PdfImage.RenderPages and dispose every returned Pix.Image. Enumeration starts rendering lazily, but ImageMagick renders and retains the entire document before yielding the first image, so large documents can require substantial memory and temporary disk space. Dispose the enumerator when stopping early. The extension methods dispose their images and pages, not the caller's engine, pool, or stream. Do not use an Engine concurrently. Pool processing is sequential per document; waiting for a pool engine is asynchronous, while rendering and OCR execute synchronously. Cancellation is checked between native operations and while waiting for the pool; it cannot interrupt a native operation in progress.
Dependencies and platforms
Magick.NET Q8 provides ImageMagick. PDF rendering also requires a separately installed Ghostscript compatible with the process architecture. On Windows, MagickNET.SetGhostscriptDirectory can specify its installation directory. ImageMagick and Ghostscript may use temporary files. Pages are composited on white and converted to Leptonica images in memory at the requested DPI. Rendering and annotation behavior can differ from the PDFium/SkiaSharp backend.
Ghostscript licensing: The free/open-source distribution is typically licensed under the GNU AGPL. A commercial license is also available. Review the license of the Ghostscript distribution you use and its obligations before deployment; see Ghostscript licensing.
The library targets .NET Framework 4.8 and .NET Standard 2.1. Platform support is the intersection of Magick.NET, Ghostscript, and TesseractOCR native dependencies; see the main repository README for OCR runtime requirements. Installing only TesseractOCR does not install these optional PDF dependencies.
Build and test from the repository root:
dotnet pack TesseractOCRPdfImageMagick\TesseractOCRPdfImageMagick.csproj -c Release -p:GeneratePackageOnBuild=false
dotnet test TesseractOCRPdfImageMagick.Tests\TesseractOCRPdfImageMagick.Tests.csproj -c Release
| Product | Versions 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. |
-
.NETFramework 4.8
- Magick.NET-Q8-AnyCPU (>= 14.17.2)
- TesseractOCR (>= 5.5.4)
-
.NETStandard 2.1
- Magick.NET-Q8-AnyCPU (>= 14.17.2)
- TesseractOCR (>= 5.5.4)
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 | 69 | 11/26/2026 |
Adds PDF support for TesseractOCR using ImageMagick