NuGet パッケージマネージャを使用して IronOCR NuGet パッケージを Visual Studio ソリューションにインストールします。
using IronOcr;using System;var ocr = new IronTesseract();using var input = new OcrInput();var pageindices = new int[] { 1, 2 };input.LoadImageFrames(@"img\example.tiff", pageindices);input.DeNoise(); //fixes digital noiseinput.Deskew(); //fixes rotation and perspective// there are dozens more filters, but most users wont need themOcrResult result = ocr.Read(input);Console.WriteLine(result.Text);
using IronOcr;
using System;
var ocr = new IronTesseract();
using var input = new OcrInput();
var pageindices = new int[] { 1, 2 };
input.LoadImageFrames(@"img\example.tiff", pageindices);
input.DeNoise(); //fixes digital noise
input.Deskew(); //fixes rotation and perspective
// there are dozens more filters, but most users wont need them
OcrResult result = ocr.Read(input);
Console.WriteLine(result.Text);
ImportsIronOcrImportsSystemPrivate ocr = New IronTesseract()Private input = New OcrInput()Private pageindices = New Integer() { 1, 2 }input.LoadImageFrames("img\example.tiff", pageindices)input.DeNoise() 'fixes digital noiseinput.Deskew() 'fixes rotation and perspective' there are dozens more filters, but most users wont need themDim result AsOcrResult = ocr.Read(input)Console.WriteLine(result.Text)
Imports IronOcr
Imports System
Private ocr = New IronTesseract()
Private input = New OcrInput()
Private pageindices = New Integer() { 1, 2 }
input.LoadImageFrames("img\example.tiff", pageindices)
input.DeNoise() 'fixes digital noise
input.Deskew() 'fixes rotation and perspective
' there are dozens more filters, but most users wont need them
Dim result As OcrResult = ocr.Read(input)
Console.WriteLine(result.Text)
このコードは、IronOCR の簡素化された API の威力を示すものです。 IronTesseract クラスは Tesseract 5 の管理されたラッパーを提供し、複雑な C++ 相互運用を排除します。OcrInput クラスは複数の画像形式とページの読み込みをサポートし、オプションの前処理メソッド(DeNoise() および Deskew())は実際のドキュメントでの精度を劇的に向上させることができます。
using IronOcr;using System;// Create an instance of the IronTesseract class for OCR processingvar ocr = new IronTesseract();// Create an OcrInput object to load and preprocess imagesusing var input = new OcrInput();// Specify which pages to extract from multi-page documentsvar pageIndices = new int[] { 1, 2 };// Load specific frames from a TIFF file// IronOCR automatically detects and handles various image formatsinput.LoadImageFrames(@"img\example.tiff", pageIndices);// Apply automatic image enhancement filters// These filters dramatically improve accuracy on imperfect scansinput.DeNoise(); // Removes digital artifacts and specklesinput.Deskew(); // Corrects rotation up to 15 degrees// Perform OCR with enhanced accuracy algorithmsOcrResult result = ocr.Read(input);// Access the extracted text with confidence metricsConsole.WriteLine(result.Text);// Additional accuracy features available:// - result.Confidence: Overall accuracy percentage// - result.Pages[0].Words: Word-level confidence scores// - result.Blocks: Structured document layout analysis
using IronOcr;
using System;
// Create an instance of the IronTesseract class for OCR processing
var ocr = new IronTesseract();
// Create an OcrInput object to load and preprocess images
using var input = new OcrInput();
// Specify which pages to extract from multi-page documents
var pageIndices = new int[] { 1, 2 };
// Load specific frames from a TIFF file
// IronOCR automatically detects and handles various image formats
input.LoadImageFrames(@"img\example.tiff", pageIndices);
// Apply automatic image enhancement filters
// These filters dramatically improve accuracy on imperfect scans
input.DeNoise(); // Removes digital artifacts and speckles
input.Deskew(); // Corrects rotation up to 15 degrees
// Perform OCR with enhanced accuracy algorithms
OcrResult result = ocr.Read(input);
// Access the extracted text with confidence metrics
Console.WriteLine(result.Text);
// Additional accuracy features available:
// - result.Confidence: Overall accuracy percentage
// - result.Pages[0].Words: Word-level confidence scores
// - result.Blocks: Structured document layout analysis
ImportsIronOcrImportsSystem' Create an instance of the IronTesseract class for OCR processingPrivate ocr = New IronTesseract()' Create an OcrInput object to load and preprocess imagesPrivate input = New OcrInput()' Specify which pages to extract from multi-page documentsPrivate pageIndices = New Integer() { 1, 2 }' Load specific frames from a TIFF file' IronOCR automatically detects and handles various image formatsinput.LoadImageFrames("img\example.tiff", pageIndices)' Apply automatic image enhancement filters' These filters dramatically improve accuracy on imperfect scansinput.DeNoise() ' Removes digital artifacts and specklesinput.Deskew() ' Corrects rotation up to 15 degrees' Perform OCR with enhanced accuracy algorithmsDim result AsOcrResult = ocr.Read(input)' Access the extracted text with confidence metricsConsole.WriteLine(result.Text)' Additional accuracy features available:' - result.Confidence: Overall accuracy percentage' - result.Pages[0].Words: Word-level confidence scores' - result.Blocks: Structured document layout analysis
Imports IronOcr
Imports System
' Create an instance of the IronTesseract class for OCR processing
Private ocr = New IronTesseract()
' Create an OcrInput object to load and preprocess images
Private input = New OcrInput()
' Specify which pages to extract from multi-page documents
Private pageIndices = New Integer() { 1, 2 }
' Load specific frames from a TIFF file
' IronOCR automatically detects and handles various image formats
input.LoadImageFrames("img\example.tiff", pageIndices)
' Apply automatic image enhancement filters
' These filters dramatically improve accuracy on imperfect scans
input.DeNoise() ' Removes digital artifacts and speckles
input.Deskew() ' Corrects rotation up to 15 degrees
' Perform OCR with enhanced accuracy algorithms
Dim result As OcrResult = ocr.Read(input)
' Access the extracted text with confidence metrics
Console.WriteLine(result.Text)
' Additional accuracy features available:
' - result.Confidence: Overall accuracy percentage
' - result.Pages[0].Words: Word-level confidence scores
' - result.Blocks: Structured document layout analysis
using IronOcr;var ocr = new IronTesseract();ocr.Language = OcrLanguage.Arabic;using var input = new OcrInput();var pageindices = new int[] { 1, 2 };input.LoadImageFrames("img/arabic.gif", pageindices);// Add image filters if needed// In this case, even thought input is very low quality// IronTesseract can read what conventional Tesseract cannot.var result = ocr.Read(input);// Console can't print Arabic on Windows easily.// Let's save to disk instead.result.SaveAsTextFile("arabic.txt");
using IronOcr;
var ocr = new IronTesseract();
ocr.Language = OcrLanguage.Arabic;
using var input = new OcrInput();
var pageindices = new int[] { 1, 2 };
input.LoadImageFrames("img/arabic.gif", pageindices);
// Add image filters if needed
// In this case, even thought input is very low quality
// IronTesseract can read what conventional Tesseract cannot.
var result = ocr.Read(input);
// Console can't print Arabic on Windows easily.
// Let's save to disk instead.
result.SaveAsTextFile("arabic.txt");
ImportsIronOcrPrivate ocr = New IronTesseract()ocr.Language = OcrLanguage.ArabicDim input = New OcrInput()Dim pageindices = New Integer() { 1, 2 }input.LoadImageFrames("img/arabic.gif", pageindices)' Add image filters if needed' In this case, even thought input is very low quality' IronTesseract can read what conventional Tesseract cannot.Dim result = ocr.Read(input)' Console can't print Arabic on Windows easily.' Let's save to disk instead.result.SaveAsTextFile("arabic.txt")
Imports IronOcr
Private ocr = New IronTesseract()
ocr.Language = OcrLanguage.Arabic
Dim input = New OcrInput()
Dim pageindices = New Integer() { 1, 2 }
input.LoadImageFrames("img/arabic.gif", pageindices)
' Add image filters if needed
' In this case, even thought input is very low quality
' IronTesseract can read what conventional Tesseract cannot.
Dim result = ocr.Read(input)
' Console can't print Arabic on Windows easily.
' Let's save to disk instead.
result.SaveAsTextFile("arabic.txt")
IronOCR は、.NET 開発者向けに特別に設計された、完全に管理された直感的な API を提供します。
最もシンプルな実装
using IronOcr;// For the Chinese Language Pack:// PM> Install IronOcr.Languages.ChineseSimplifiedvar ocr = new IronTesseract();ocr.Language = OcrLanguage.ChineseSimplified;ocr.AddSecondaryLanguage(OcrLanguage.English);// We can add any number of languagesusing var input = new OcrInput();input.LoadPdf("multi-language.pdf");var result = ocr.Read(input);result.SaveAsTextFile("results.txt");
using IronOcr;
// For the Chinese Language Pack:
// PM> Install IronOcr.Languages.ChineseSimplified
var ocr = new IronTesseract();
ocr.Language = OcrLanguage.ChineseSimplified;
ocr.AddSecondaryLanguage(OcrLanguage.English);
// We can add any number of languages
using var input = new OcrInput();
input.LoadPdf("multi-language.pdf");
var result = ocr.Read(input);
result.SaveAsTextFile("results.txt");
ImportsIronOcr' For the Chinese Language Pack:' PM> Install IronOcr.Languages.ChineseSimplifiedPrivate ocr = New IronTesseract()ocr.Language = OcrLanguage.ChineseSimplifiedocr.AddSecondaryLanguage(OcrLanguage.English)' We can add any number of languagesDim input = New OcrInput()input.LoadPdf("multi-language.pdf")Dim result = ocr.Read(input)result.SaveAsTextFile("results.txt")
Imports IronOcr
' For the Chinese Language Pack:
' PM> Install IronOcr.Languages.ChineseSimplified
Private ocr = New IronTesseract()
ocr.Language = OcrLanguage.ChineseSimplified
ocr.AddSecondaryLanguage(OcrLanguage.English)
' We can add any number of languages
Dim input = New OcrInput()
input.LoadPdf("multi-language.pdf")
Dim result = ocr.Read(input)
result.SaveAsTextFile("results.txt")
この合理化された API により、従来の Tesseract 統合の複雑さが解消されます。 各メソッドには包括的なXMLドキュメントが付属しており、IDE内で直接機能を簡単に確認できます。充実したAPIドキュメントには、各機能の詳細な例が掲載されています。
各ターゲット環境には、異なるバイナリ、ランタイム依存関係、および権限が必要です。 Docker コンテナでは、ベースイメージを慎重に選択する必要があります。 Visual C++ ランタイムが不足しているために、Azure のデプロイメントが失敗することがよくあります。 Linux の互換性は、特定のディストリビューションとパッケージの可用性によって異なります。
using IronOcr;// Configure IronTesseract for Arabic text recognitionvar ocr = new IronTesseract{ // Set primary language to Arabic // Automatically handles right-to-left textLanguage = OcrLanguage.Arabic};// Load Arabic documents for processingusing var input = new OcrInput();var pageIndices = new int[] { 1, 2 };input.LoadImageFrames("img/arabic.gif", pageIndices);// IronOCR includes specialized preprocessing for Arabic scripts// Handles cursive text and diacritical marks automatically// Perform OCR with language-specific optimizationsvar result = ocr.Read(input);// Save results with proper Unicode encoding// Preserves Arabic text formatting and directionresult.SaveAsTextFile("arabic.txt");// Advanced Arabic features:// - Mixed Arabic/English document support// - Automatic number conversion (Eastern/Western Arabic)// - Font-specific optimization for common Arabic typefaces
using IronOcr;
// Configure IronTesseract for Arabic text recognition
var ocr = new IronTesseract
{
// Set primary language to Arabic
// Automatically handles right-to-left text
Language = OcrLanguage.Arabic
};
// Load Arabic documents for processing
using var input = new OcrInput();
var pageIndices = new int[] { 1, 2 };
input.LoadImageFrames("img/arabic.gif", pageIndices);
// IronOCR includes specialized preprocessing for Arabic scripts
// Handles cursive text and diacritical marks automatically
// Perform OCR with language-specific optimizations
var result = ocr.Read(input);
// Save results with proper Unicode encoding
// Preserves Arabic text formatting and direction
result.SaveAsTextFile("arabic.txt");
// Advanced Arabic features:
// - Mixed Arabic/English document support
// - Automatic number conversion (Eastern/Western Arabic)
// - Font-specific optimization for common Arabic typefaces
ImportsIronOcr' Configure IronTesseract for Arabic text recognitionPrivate ocr = New IronTesseractWith {.Language = OcrLanguage.Arabic}' Load Arabic documents for processingPrivate input = New OcrInput()Private pageIndices = New Integer() { 1, 2 }input.LoadImageFrames("img/arabic.gif", pageIndices)' IronOCR includes specialized preprocessing for Arabic scripts' Handles cursive text and diacritical marks automatically' Perform OCR with language-specific optimizationsDim result = ocr.Read(input)' Save results with proper Unicode encoding' Preserves Arabic text formatting and directionresult.SaveAsTextFile("arabic.txt")' Advanced Arabic features:' - Mixed Arabic/English document support' - Automatic number conversion (Eastern/Western Arabic)' - Font-specific optimization for common Arabic typefaces
Imports IronOcr
' Configure IronTesseract for Arabic text recognition
Private ocr = New IronTesseract With {.Language = OcrLanguage.Arabic}
' Load Arabic documents for processing
Private input = New OcrInput()
Private pageIndices = New Integer() { 1, 2 }
input.LoadImageFrames("img/arabic.gif", pageIndices)
' IronOCR includes specialized preprocessing for Arabic scripts
' Handles cursive text and diacritical marks automatically
' Perform OCR with language-specific optimizations
Dim result = ocr.Read(input)
' Save results with proper Unicode encoding
' Preserves Arabic text formatting and direction
result.SaveAsTextFile("arabic.txt")
' Advanced Arabic features:
' - Mixed Arabic/English document support
' - Automatic number conversion (Eastern/Western Arabic)
' - Font-specific optimization for common Arabic typefaces
多言語ドキュメント処理
using IronOcr;// Install language packs via NuGet:// PM> Install-Package IronOcr.Languages.ChineseSimplified// Configure multi-language OCRvar ocr = new IronTesseract();// Set primary language for majority contentocr.Language = OcrLanguage.ChineseSimplified;// Add secondary language for mixed content// Perfect for documents with Chinese text and English metadataocr.AddSecondaryLanguage(OcrLanguage.English);// Process multi-language PDFs efficientlyusing var input = new OcrInput();input.LoadPdf("multi-language.pdf");// IronOCR automatically detects and switches between languages// Maintains high accuracy across language boundariesvar result = ocr.Read(input);// Export preserves all languages correctlyresult.SaveAsTextFile("results.txt");// Supported scenarios:// - Technical documents with English terms in foreign text// - Multilingual forms and applications // - International business documents// - Mixed-script content (Latin, CJK, Arabic, etc.)
using IronOcr;
// Install language packs via NuGet:
// PM> Install-Package IronOcr.Languages.ChineseSimplified
// Configure multi-language OCR
var ocr = new IronTesseract();
// Set primary language for majority content
ocr.Language = OcrLanguage.ChineseSimplified;
// Add secondary language for mixed content
// Perfect for documents with Chinese text and English metadata
ocr.AddSecondaryLanguage(OcrLanguage.English);
// Process multi-language PDFs efficiently
using var input = new OcrInput();
input.LoadPdf("multi-language.pdf");
// IronOCR automatically detects and switches between languages
// Maintains high accuracy across language boundaries
var result = ocr.Read(input);
// Export preserves all languages correctly
result.SaveAsTextFile("results.txt");
// Supported scenarios:
// - Technical documents with English terms in foreign text
// - Multilingual forms and applications
// - International business documents
// - Mixed-script content (Latin, CJK, Arabic, etc.)
ImportsIronOcr' Install language packs via NuGet:' PM> Install-Package IronOcr.Languages.ChineseSimplified' Configure multi-language OCRPrivate ocr = New IronTesseract()' Set primary language for majority contentocr.Language = OcrLanguage.ChineseSimplified' Add secondary language for mixed content' Perfect for documents with Chinese text and English metadataocr.AddSecondaryLanguage(OcrLanguage.English)' Process multi-language PDFs efficientlyDim input = New OcrInput()input.LoadPdf("multi-language.pdf")' IronOCR automatically detects and switches between languages' Maintains high accuracy across language boundariesDim result = ocr.Read(input)' Export preserves all languages correctlyresult.SaveAsTextFile("results.txt")' Supported scenarios:' - Technical documents with English terms in foreign text' - Multilingual forms and applications ' - International business documents' - Mixed-script content (Latin, CJK, Arabic, etc.)
Imports IronOcr
' Install language packs via NuGet:
' PM> Install-Package IronOcr.Languages.ChineseSimplified
' Configure multi-language OCR
Private ocr = New IronTesseract()
' Set primary language for majority content
ocr.Language = OcrLanguage.ChineseSimplified
' Add secondary language for mixed content
' Perfect for documents with Chinese text and English metadata
ocr.AddSecondaryLanguage(OcrLanguage.English)
' Process multi-language PDFs efficiently
Dim input = New OcrInput()
input.LoadPdf("multi-language.pdf")
' IronOCR automatically detects and switches between languages
' Maintains high accuracy across language boundaries
Dim result = ocr.Read(input)
' Export preserves all languages correctly
result.SaveAsTextFile("results.txt")
' Supported scenarios:
' - Technical documents with English terms in foreign text
' - Multilingual forms and applications
' - International business documents
' - Mixed-script content (Latin, CJK, Arabic, etc.)
How does IronOCR handle OCR for different image formats?
IronOCR automatically manages image conversions for various formats such as JPEG, PNG, BMP, and supports .NET types, providing a consistent API for all image processing needs.
Why is IronOCR a preferred choice for professional OCR solutions in C#?
IronOCR is preferred for professional OCR due to its ease of use, reliable feature set, cross-platform compatibility, and reliable support, making it ideal for production environments.