Энэхүү C# кодын жишээ нь Image эсвэл PDF баримт бичгийн монгол текстийг уншдаг.
// PM> Install-Package IronOcr.Languages.Mongolianusing IronOcr;// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();// Set the language to MongolianOcr.Language = OcrLanguage.Mongolian;// Use a using statement to properly dispose of the OcrInput objectusing (varInput = new OcrInput(@"images\Mongolian.png")){ // Read the image and get the OCR result varResult = Ocr.Read(Input); // Extract all recognized text from the result varAllText = Result.Text;}
// PM> Install-Package IronOcr.Languages.Mongolian
using IronOcr;
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the language to Mongolian
Ocr.Language = OcrLanguage.Mongolian;
// Use a using statement to properly dispose of the OcrInput object
using (var Input = new OcrInput(@"images\Mongolian.png"))
{
// Read the image and get the OCR result
var Result = Ocr.Read(Input);
// Extract all recognized text from the result
var AllText = Result.Text;
}
' PM> Install-Package IronOcr.Languages.MongolianImportsIronOcr' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()' Set the language to MongolianOcr.Language = OcrLanguage.Mongolian' Use a using statement to properly dispose of the OcrInput objectUsingInput = New OcrInput("images\Mongolian.png") ' Read the image and get the OCR result DimResult = Ocr.Read(Input) ' Extract all recognized text from the result DimAllText = Result.TextEndUsing
' PM> Install-Package IronOcr.Languages.Mongolian
Imports IronOcr
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
' Set the language to Mongolian
Ocr.Language = OcrLanguage.Mongolian
' Use a using statement to properly dispose of the OcrInput object
Using Input = New OcrInput("images\Mongolian.png")
' Read the image and get the OCR result
Dim Result = Ocr.Read(Input)
' Extract all recognized text from the result
Dim AllText = Result.Text
End Using
Яагаад IronOCR-ийг сонгох хэрэгтэй вэ?
IronOCR бол суулгахад хялбар, бүрэн гүйцэд, сайн баримтжуулсан .NET програм хангамжийн номын сан юм.
// A single-line example of using IronTesseract to read an imagestringText = new IronTesseract().Read(@"img\Screenshot.png").Text;
// A single-line example of using IronTesseract to read an image
string Text = new IronTesseract().Read(@"img\Screenshot.png").Text;
' A single-line example of using IronTesseract to read an imageDimTextAsString = (New IronTesseract()).Read("img\Screenshot.png").Text
' A single-line example of using IronTesseract to read an image
Dim Text As String = (New IronTesseract()).Read("img\Screenshot.png").Text
Тохируулгатай Hello World
// PM> Install-Package IronOcr.Languages.Mongolianusing IronOcr;// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();// Set the language to MongolianOcr.Language = OcrLanguage.Mongolian;// Use a using statement to properly dispose of the OcrInput objectusing (varInput = new OcrInput()){ // Add an image to the OCR inputInput.AddImage("images/sample.jpeg"); //... та хэдэн ч зураг нэмж болно (you can add more images) // Read the image and get the OCR result varResult = Ocr.Read(Input); // Output the recognized text to the consoleConsole.WriteLine(Result.Text);}
// PM> Install-Package IronOcr.Languages.Mongolian
using IronOcr;
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the language to Mongolian
Ocr.Language = OcrLanguage.Mongolian;
// Use a using statement to properly dispose of the OcrInput object
using (var Input = new OcrInput())
{
// Add an image to the OCR input
Input.AddImage("images/sample.jpeg");
//... та хэдэн ч зураг нэмж болно (you can add more images)
// Read the image and get the OCR result
var Result = Ocr.Read(Input);
// Output the recognized text to the console
Console.WriteLine(Result.Text);
}
ImportsIronOcr' Create a new instance of the IronTesseract OCR engineDimOcrAs New IronTesseract()' Set the language to MongolianOcr.Language = OcrLanguage.Mongolian' Use a Using block to properly dispose of the OcrInput objectUsingInputAs New OcrInput() ' Add an image to the OCR inputInput.AddImage("images/sample.jpeg") '... та хэдэн ч зураг нэмж болно (you can add more images) ' Read the image and get the OCR result DimResult = Ocr.Read(Input) ' Output the recognized text to the consoleConsole.WriteLine(Result.Text)EndUsing
Imports IronOcr
' Create a new instance of the IronTesseract OCR engine
Dim Ocr As New IronTesseract()
' Set the language to Mongolian
Ocr.Language = OcrLanguage.Mongolian
' Use a Using block to properly dispose of the OcrInput object
Using Input As New OcrInput()
' Add an image to the OCR input
Input.AddImage("images/sample.jpeg")
'... та хэдэн ч зураг нэмж болно (you can add more images)
' Read the image and get the OCR result
Dim Result = Ocr.Read(Input)
' Output the recognized text to the console
Console.WriteLine(Result.Text)
End Using
C# PDF OCR
Үүнтэй ижил аргыг аливаа PDF баримт бичгээс текст гаргаж авахад ашиглаж болно.
using IronOcr;// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();Ocr.Language = OcrLanguage.Mongolian;// Use a using statement to properly dispose of the OcrInput objectusing (var input = new OcrInput()){ // Add a PDF file to the OCR input input.AddPdf("example.pdf", "password"); // Optionally, specify a password // Read the PDF and get the OCR result varResult = Ocr.Read(input); // Output the recognized text to the consoleConsole.WriteLine(Result.Text); // Output the total number of pages to the consoleConsole.WriteLine($"{Result.Pages.Count()} Pages"); // PDF файлын хуудас бүрт 1 хуудас (1 page per PDF file page)}
using IronOcr;
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Mongolian;
// Use a using statement to properly dispose of the OcrInput object
using (var input = new OcrInput())
{
// Add a PDF file to the OCR input
input.AddPdf("example.pdf", "password"); // Optionally, specify a password
// Read the PDF and get the OCR result
var Result = Ocr.Read(input);
// Output the recognized text to the console
Console.WriteLine(Result.Text);
// Output the total number of pages to the console
Console.WriteLine($"{Result.Pages.Count()} Pages");
// PDF файлын хуудас бүрт 1 хуудас (1 page per PDF file page)
}
ImportsIronOcr' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()Ocr.Language = OcrLanguage.Mongolian' Use a using statement to properly dispose of the OcrInput objectUsing input = New OcrInput() ' Add a PDF file to the OCR input input.AddPdf("example.pdf", "password") ' Optionally, specify a password ' Read the PDF and get the OCR result DimResult = Ocr.Read(input) ' Output the recognized text to the consoleConsole.WriteLine(Result.Text) ' Output the total number of pages to the consoleConsole.WriteLine($"{Result.Pages.Count()} Pages") ' PDF файлын хуудас бүрт 1 хуудас (1 page per PDF file page)EndUsing
Imports IronOcr
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.Mongolian
' Use a using statement to properly dispose of the OcrInput object
Using input = New OcrInput()
' Add a PDF file to the OCR input
input.AddPdf("example.pdf", "password") ' Optionally, specify a password
' Read the PDF and get the OCR result
Dim Result = Ocr.Read(input)
' Output the recognized text to the console
Console.WriteLine(Result.Text)
' Output the total number of pages to the console
Console.WriteLine($"{Result.Pages.Count()} Pages")
' PDF файлын хуудас бүрт 1 хуудас (1 page per PDF file page)
End Using
MultiPage TIFF-д зориулсан OCR
Олон хуудасны баримт бичгийг багтаасан OCR унших TIFF файлын формат. TIFF-ийг хайлтын текст бүхий PDF файл болгон шууд хөрвүүлэх боломжтой.
using IronOcr;// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();Ocr.Language = OcrLanguage.Mongolian;// Use a using statement to properly dispose of the OcrInput objectusing (varInput = new OcrInput()){ // Add a multipage TIFF image to the OCR inputInput.AddMultiFrameTiff("multi-frame.tiff"); // Read the TIFF and get the OCR result varResult = Ocr.Read(Input); // Output the recognized text to the consoleConsole.WriteLine(Result.Text);}
using IronOcr;
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Mongolian;
// Use a using statement to properly dispose of the OcrInput object
using (var Input = new OcrInput())
{
// Add a multipage TIFF image to the OCR input
Input.AddMultiFrameTiff("multi-frame.tiff");
// Read the TIFF and get the OCR result
var Result = Ocr.Read(Input);
// Output the recognized text to the console
Console.WriteLine(Result.Text);
}
ImportsIronOcr' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()Ocr.Language = OcrLanguage.Mongolian' Use a using statement to properly dispose of the OcrInput objectUsingInput = New OcrInput() ' Add a multipage TIFF image to the OCR inputInput.AddMultiFrameTiff("multi-frame.tiff") ' Read the TIFF and get the OCR result DimResult = Ocr.Read(Input) ' Output the recognized text to the consoleConsole.WriteLine(Result.Text)EndUsing
Imports IronOcr
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.Mongolian
' Use a using statement to properly dispose of the OcrInput object
Using Input = New OcrInput()
' Add a multipage TIFF image to the OCR input
Input.AddMultiFrameTiff("multi-frame.tiff")
' Read the TIFF and get the OCR result
Dim Result = Ocr.Read(Input)
' Output the recognized text to the console
Console.WriteLine(Result.Text)
End Using
Баркод ба QR
IronOCR-ийн өвөрмөц шинж чанар нь текст хайх явцад баримт бичгээс бар код, QR кодыг унших боломжтой юм. OcrResult.OcrBarcode Class-ийн тохиолдлууд нь хөгжүүлэгчдэд сканнердсан бар код бүрийн талаар дэлгэрэнгүй мэдээлэл өгдөг.
using IronOcr;// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();Ocr.Configuration.ReadBarCodes = true;// Use a using statement to properly dispose of the OcrInput objectusing (var input = new OcrInput()){ // Add an image containing a barcode to the OCR input input.AddImage("img/Barcode.png"); // Read the image and get the OCR result varResult = Ocr.Read(input); // Iterate over the recognized barcodes and output their values foreach (varBarcodeinResult.Barcodes) {Console.WriteLine(Barcode.Value); // төрөл, байршлын шинж чанарууд бас ил гарсан (Additional properties for type, location are also available) }}
using IronOcr;
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
Ocr.Configuration.ReadBarCodes = true;
// Use a using statement to properly dispose of the OcrInput object
using (var input = new OcrInput())
{
// Add an image containing a barcode to the OCR input
input.AddImage("img/Barcode.png");
// Read the image and get the OCR result
var Result = Ocr.Read(input);
// Iterate over the recognized barcodes and output their values
foreach (var Barcode in Result.Barcodes)
{
Console.WriteLine(Barcode.Value);
// төрөл, байршлын шинж чанарууд бас ил гарсан (Additional properties for type, location are also available)
}
}
ImportsIronOcr' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()Ocr.Configuration.ReadBarCodes = True' Use a using statement to properly dispose of the OcrInput objectUsing input = New OcrInput() ' Add an image containing a barcode to the OCR input input.AddImage("img/Barcode.png") ' Read the image and get the OCR result DimResult = Ocr.Read(input) ' Iterate over the recognized barcodes and output their values For EachBarcodeInResult.BarcodesConsole.WriteLine(Barcode.Value) ' төрөл, байршлын шинж чанарууд бас ил гарсан (Additional properties for type, location are also available) NextBarcodeEndUsing
Imports IronOcr
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
Ocr.Configuration.ReadBarCodes = True
' Use a using statement to properly dispose of the OcrInput object
Using input = New OcrInput()
' Add an image containing a barcode to the OCR input
input.AddImage("img/Barcode.png")
' Read the image and get the OCR result
Dim Result = Ocr.Read(input)
' Iterate over the recognized barcodes and output their values
For Each Barcode In Result.Barcodes
Console.WriteLine(Barcode.Value)
' төрөл, байршлын шинж чанарууд бас ил гарсан (Additional properties for type, location are also available)
Next Barcode
End Using
using IronOcr;using System.Drawing; // Required for the Rectangle class// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();Ocr.Language = OcrLanguage.Mongolian;// Use a using statement to properly dispose of the OcrInput objectusing (varInput = new OcrInput()){ // Define the area of the image to perform OCR on varContentArea = new Rectangle() { X = 215, Y = 1250, Height = 280, Width = 1335 }; // Хэмжээ нь px байна (Dimensions are in pixels) // Add the specified area of the image to the OCR inputInput.Add("document.png", ContentArea); // Read the image and get the OCR result varResult = Ocr.Read(Input); // Output the recognized text to the consoleConsole.WriteLine(Result.Text);}
using IronOcr;
using System.Drawing; // Required for the Rectangle class
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Mongolian;
// Use a using statement to properly dispose of the OcrInput object
using (var Input = new OcrInput())
{
// Define the area of the image to perform OCR on
var ContentArea = new Rectangle() { X = 215, Y = 1250, Height = 280, Width = 1335 };
// Хэмжээ нь px байна (Dimensions are in pixels)
// Add the specified area of the image to the OCR input
Input.Add("document.png", ContentArea);
// Read the image and get the OCR result
var Result = Ocr.Read(Input);
// Output the recognized text to the console
Console.WriteLine(Result.Text);
}
ImportsIronOcrImportsSystem.Drawing' Required for the Rectangle class' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()Ocr.Language = OcrLanguage.Mongolian' Use a using statement to properly dispose of the OcrInput objectUsingInput = New OcrInput() ' Define the area of the image to perform OCR on DimContentArea = New Rectangle() With { .X = 215, .Y = 1250, .Height = 280, .Width = 1335 } ' Хэмжээ нь px байна (Dimensions are in pixels) ' Add the specified area of the image to the OCR inputInput.Add("document.png", ContentArea) ' Read the image and get the OCR result DimResult = Ocr.Read(Input) ' Output the recognized text to the consoleConsole.WriteLine(Result.Text)EndUsing
Imports IronOcr
Imports System.Drawing ' Required for the Rectangle class
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.Mongolian
' Use a using statement to properly dispose of the OcrInput object
Using Input = New OcrInput()
' Define the area of the image to perform OCR on
Dim ContentArea = New Rectangle() With {
.X = 215,
.Y = 1250,
.Height = 280,
.Width = 1335
}
' Хэмжээ нь px байна (Dimensions are in pixels)
' Add the specified area of the image to the OCR input
Input.Add("document.png", ContentArea)
' Read the image and get the OCR result
Dim Result = Ocr.Read(Input)
' Output the recognized text to the console
Console.WriteLine(Result.Text)
End Using
using IronOcr;// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();Ocr.Language = OcrLanguage.Mongolian;// Use a using statement to properly dispose of the OcrInput objectusing (varInput = new OcrInput(@"img\Potter.LowQuality.tiff")){ // Apply noise reductionInput.DeNoise(); // дижитал дуу чимээ, муу сканнердлыг засдаг // Correct skewInput.Deskew(); // эргэлт ба хэтийн төлөвийг засдаг // Read the image and get the OCR result varResult = Ocr.Read(Input); // Output the recognized text to the consoleConsole.WriteLine(Result.Text);}
using IronOcr;
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Mongolian;
// Use a using statement to properly dispose of the OcrInput object
using (var Input = new OcrInput(@"img\Potter.LowQuality.tiff"))
{
// Apply noise reduction
Input.DeNoise(); // дижитал дуу чимээ, муу сканнердлыг засдаг
// Correct skew
Input.Deskew(); // эргэлт ба хэтийн төлөвийг засдаг
// Read the image and get the OCR result
var Result = Ocr.Read(Input);
// Output the recognized text to the console
Console.WriteLine(Result.Text);
}
ImportsIronOcr' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()Ocr.Language = OcrLanguage.Mongolian' Use a using statement to properly dispose of the OcrInput objectUsingInput = New OcrInput("img\Potter.LowQuality.tiff") ' Apply noise reductionInput.DeNoise() ' дижитал дуу чимээ, муу сканнердлыг засдаг ' Correct skewInput.Deskew() ' эргэлт ба хэтийн төлөвийг засдаг ' Read the image and get the OCR result DimResult = Ocr.Read(Input) ' Output the recognized text to the consoleConsole.WriteLine(Result.Text)EndUsing
Imports IronOcr
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.Mongolian
' Use a using statement to properly dispose of the OcrInput object
Using Input = New OcrInput("img\Potter.LowQuality.tiff")
' Apply noise reduction
Input.DeNoise() ' дижитал дуу чимээ, муу сканнердлыг засдаг
' Correct skew
Input.Deskew() ' эргэлт ба хэтийн төлөвийг засдаг
' Read the image and get the OCR result
Dim Result = Ocr.Read(Input)
' Output the recognized text to the console
Console.WriteLine(Result.Text)
End Using
OCR-ийн үр дүнг хайх боломжтой PDF хэлбэрээр экспортлох
Хуулж авах текст мөр бүхий PDF формат руу зураг. Хайлтын систем, мэдээллийн баазаар индексжүүлж болно.
using IronOcr;// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();Ocr.Language = OcrLanguage.Mongolian;// Use a using statement to properly dispose of the OcrInput objectusing (varInput = new OcrInput()){ // Set the title of the resulting PDFInput.Title = "Quarterly Report"; // Add multiple images to the OCR inputInput.AddImage("image1.jpeg");Input.AddImage("image2.png");Input.AddImage("image3.gif"); // Read the images and get the OCR result varResult = Ocr.Read(Input); // Save the OCR result as a searchable PDFResult.SaveAsSearchablePdf("searchable.pdf");}
using IronOcr;
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Mongolian;
// Use a using statement to properly dispose of the OcrInput object
using (var Input = new OcrInput())
{
// Set the title of the resulting PDF
Input.Title = "Quarterly Report";
// Add multiple images to the OCR input
Input.AddImage("image1.jpeg");
Input.AddImage("image2.png");
Input.AddImage("image3.gif");
// Read the images and get the OCR result
var Result = Ocr.Read(Input);
// Save the OCR result as a searchable PDF
Result.SaveAsSearchablePdf("searchable.pdf");
}
ImportsIronOcr' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()Ocr.Language = OcrLanguage.Mongolian' Use a using statement to properly dispose of the OcrInput objectUsingInput = New OcrInput() ' Set the title of the resulting PDFInput.Title = "Quarterly Report" ' Add multiple images to the OCR inputInput.AddImage("image1.jpeg")Input.AddImage("image2.png")Input.AddImage("image3.gif") ' Read the images and get the OCR result DimResult = Ocr.Read(Input) ' Save the OCR result as a searchable PDFResult.SaveAsSearchablePdf("searchable.pdf")EndUsing
Imports IronOcr
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.Mongolian
' Use a using statement to properly dispose of the OcrInput object
Using Input = New OcrInput()
' Set the title of the resulting PDF
Input.Title = "Quarterly Report"
' Add multiple images to the OCR input
Input.AddImage("image1.jpeg")
Input.AddImage("image2.png")
Input.AddImage("image3.gif")
' Read the images and get the OCR result
Dim Result = Ocr.Read(Input)
' Save the OCR result as a searchable PDF
Result.SaveAsSearchablePdf("searchable.pdf")
End Using
using IronOcr;// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();Ocr.Language = OcrLanguage.Mongolian;// Use a using statement to properly dispose of the OcrInput objectusing (varInput = new OcrInput()){ // Add a multi-frame TIFF image to the OCR inputInput.AddMultiFrameTiff("example.tiff"); // Read the TIFF and save the OCR result as a searchable PDF varResult = Ocr.Read(Input).SaveAsSearchablePdf("searchable.pdf");}
using IronOcr;
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Mongolian;
// Use a using statement to properly dispose of the OcrInput object
using (var Input = new OcrInput())
{
// Add a multi-frame TIFF image to the OCR input
Input.AddMultiFrameTiff("example.tiff");
// Read the TIFF and save the OCR result as a searchable PDF
var Result = Ocr.Read(Input).SaveAsSearchablePdf("searchable.pdf");
}
ImportsIronOcr' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()Ocr.Language = OcrLanguage.Mongolian' Use a using statement to properly dispose of the OcrInput objectUsingInput = New OcrInput() ' Add a multi-frame TIFF image to the OCR inputInput.AddMultiFrameTiff("example.tiff") ' Read the TIFF and save the OCR result as a searchable PDF DimResult = Ocr.Read(Input).SaveAsSearchablePdf("searchable.pdf")EndUsing
Imports IronOcr
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.Mongolian
' Use a using statement to properly dispose of the OcrInput object
Using Input = New OcrInput()
' Add a multi-frame TIFF image to the OCR input
Input.AddMultiFrameTiff("example.tiff")
' Read the TIFF and save the OCR result as a searchable PDF
Dim Result = Ocr.Read(Input).SaveAsSearchablePdf("searchable.pdf")
End Using
OCR-ийн үр дүнг HTML хэлбэрээр экспортлох
OCR зургийг XHTML руу хөрвүүлэх.
using IronOcr;// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();Ocr.Language = OcrLanguage.Mongolian;// Use a using statement to properly dispose of the OcrInput objectusing (varInput = new OcrInput()){ // Set the title for the HTML documentInput.Title = "Html Title"; // Add an image to the OCR inputInput.AddImage("image1.jpeg"); // Read the image and get the OCR result varResult = Ocr.Read(Input); // Save the OCR result as an HOCR fileResult.SaveAsHocrFile("results.html");}
using IronOcr;
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Mongolian;
// Use a using statement to properly dispose of the OcrInput object
using (var Input = new OcrInput())
{
// Set the title for the HTML document
Input.Title = "Html Title";
// Add an image to the OCR input
Input.AddImage("image1.jpeg");
// Read the image and get the OCR result
var Result = Ocr.Read(Input);
// Save the OCR result as an HOCR file
Result.SaveAsHocrFile("results.html");
}
ImportsIronOcr' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()Ocr.Language = OcrLanguage.Mongolian' Use a using statement to properly dispose of the OcrInput objectUsingInput = New OcrInput() ' Set the title for the HTML documentInput.Title = "Html Title" ' Add an image to the OCR inputInput.AddImage("image1.jpeg") ' Read the image and get the OCR result DimResult = Ocr.Read(Input) ' Save the OCR result as an HOCR fileResult.SaveAsHocrFile("results.html")EndUsing
Imports IronOcr
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.Mongolian
' Use a using statement to properly dispose of the OcrInput object
Using Input = New OcrInput()
' Set the title for the HTML document
Input.Title = "Html Title"
' Add an image to the OCR input
Input.AddImage("image1.jpeg")
' Read the image and get the OCR result
Dim Result = Ocr.Read(Input)
' Save the OCR result as an HOCR file
Result.SaveAsHocrFile("results.html")
End Using
using IronOcr;// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();Ocr.Language = OcrLanguage.Mongolian;// Use a using statement to properly dispose of the OcrInput objectusing (varInput = new OcrInput(@"LowQuality.jpeg")){ // Apply noise reductionInput.DeNoise(); // дижитал дуу чимээ, муу сканнердлыг засдаг // Correct skewInput.Deskew(); // эргэлт ба хэтийн төлөвийг засдаг // Read the image and get the OCR result varResult = Ocr.Read(Input); // Output the recognized text to the consoleConsole.WriteLine(Result.Text);}
using IronOcr;
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Mongolian;
// Use a using statement to properly dispose of the OcrInput object
using (var Input = new OcrInput(@"LowQuality.jpeg"))
{
// Apply noise reduction
Input.DeNoise(); // дижитал дуу чимээ, муу сканнердлыг засдаг
// Correct skew
Input.Deskew(); // эргэлт ба хэтийн төлөвийг засдаг
// Read the image and get the OCR result
var Result = Ocr.Read(Input);
// Output the recognized text to the console
Console.WriteLine(Result.Text);
}
ImportsIronOcr' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()Ocr.Language = OcrLanguage.Mongolian' Use a using statement to properly dispose of the OcrInput objectUsingInput = New OcrInput("LowQuality.jpeg") ' Apply noise reductionInput.DeNoise() ' дижитал дуу чимээ, муу сканнердлыг засдаг ' Correct skewInput.Deskew() ' эргэлт ба хэтийн төлөвийг засдаг ' Read the image and get the OCR result DimResult = Ocr.Read(Input) ' Output the recognized text to the consoleConsole.WriteLine(Result.Text)EndUsing
Imports IronOcr
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.Mongolian
' Use a using statement to properly dispose of the OcrInput object
Using Input = New OcrInput("LowQuality.jpeg")
' Apply noise reduction
Input.DeNoise() ' дижитал дуу чимээ, муу сканнердлыг засдаг
' Correct skew
Input.Deskew() ' эргэлт ба хэтийн төлөвийг засдаг
' Read the image and get the OCR result
Dim Result = Ocr.Read(Input)
' Output the recognized text to the console
Console.WriteLine(Result.Text)
End Using
// using IronOcr;// PM> Install IronOcr.Languages.Arabicusing IronOcr;// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();Ocr.Language = OcrLanguage.Arabic;// Use a using statement to properly dispose of the OcrInput objectusing (var input = new OcrInput()){ // Add an image containing Arabic text to the OCR input input.AddImage("img/arabic.gif"); // Optional: Add image filters to improve OCR performance // Handling low-quality inputs that normal Tesseract may struggle with // Read the image and get the OCR result varResult = Ocr.Read(input); // Because Arabic text may not render well in console, save it to a text fileResult.SaveAsTextFile("arabic.txt");}
// using IronOcr;
// PM> Install IronOcr.Languages.Arabic
using IronOcr;
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Arabic;
// Use a using statement to properly dispose of the OcrInput object
using (var input = new OcrInput())
{
// Add an image containing Arabic text to the OCR input
input.AddImage("img/arabic.gif");
// Optional: Add image filters to improve OCR performance
// Handling low-quality inputs that normal Tesseract may struggle with
// Read the image and get the OCR result
var Result = Ocr.Read(input);
// Because Arabic text may not render well in console, save it to a text file
Result.SaveAsTextFile("arabic.txt");
}
' using IronOcr;' PM> Install IronOcr.Languages.ArabicImportsIronOcr' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()Ocr.Language = OcrLanguage.Arabic' Use a using statement to properly dispose of the OcrInput objectUsing input = New OcrInput() ' Add an image containing Arabic text to the OCR input input.AddImage("img/arabic.gif") ' Optional: Add image filters to improve OCR performance ' Handling low-quality inputs that normal Tesseract may struggle with ' Read the image and get the OCR result DimResult = Ocr.Read(input) ' Because Arabic text may not render well in console, save it to a text fileResult.SaveAsTextFile("arabic.txt")EndUsing
' using IronOcr;
' PM> Install IronOcr.Languages.Arabic
Imports IronOcr
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.Arabic
' Use a using statement to properly dispose of the OcrInput object
Using input = New OcrInput()
' Add an image containing Arabic text to the OCR input
input.AddImage("img/arabic.gif")
' Optional: Add image filters to improve OCR performance
' Handling low-quality inputs that normal Tesseract may struggle with
' Read the image and get the OCR result
Dim Result = Ocr.Read(input)
' Because Arabic text may not render well in console, save it to a text file
Result.SaveAsTextFile("arabic.txt")
End Using
// using IronOcr;// PM> Install IronOcr.Languages.ChineseSimplifiedusing IronOcr;// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();Ocr.Language = OcrLanguage.ChineseSimplified;// Add a secondary language, optionally more can be addedOcr.AddSecondaryLanguage(OcrLanguage.Mongolian);// Use a using statement to properly dispose of the OcrInput objectusing (var input = new OcrInput()){ // Add a multi-language document to the OCR input input.Add("multi-language.pdf"); // Read the document and get the OCR result varResult = Ocr.Read(input); // Save the result to a text fileResult.SaveAsTextFile("results.txt");}
// using IronOcr;
// PM> Install IronOcr.Languages.ChineseSimplified
using IronOcr;
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.ChineseSimplified;
// Add a secondary language, optionally more can be added
Ocr.AddSecondaryLanguage(OcrLanguage.Mongolian);
// Use a using statement to properly dispose of the OcrInput object
using (var input = new OcrInput())
{
// Add a multi-language document to the OCR input
input.Add("multi-language.pdf");
// Read the document and get the OCR result
var Result = Ocr.Read(input);
// Save the result to a text file
Result.SaveAsTextFile("results.txt");
}
' using IronOcr;' PM> Install IronOcr.Languages.ChineseSimplifiedImportsIronOcr' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()Ocr.Language = OcrLanguage.ChineseSimplified' Add a secondary language, optionally more can be addedOcr.AddSecondaryLanguage(OcrLanguage.Mongolian)' Use a using statement to properly dispose of the OcrInput objectUsing input = New OcrInput() ' Add a multi-language document to the OCR input input.Add("multi-language.pdf") ' Read the document and get the OCR result DimResult = Ocr.Read(input) ' Save the result to a text fileResult.SaveAsTextFile("results.txt")EndUsing
' using IronOcr;
' PM> Install IronOcr.Languages.ChineseSimplified
Imports IronOcr
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.ChineseSimplified
' Add a secondary language, optionally more can be added
Ocr.AddSecondaryLanguage(OcrLanguage.Mongolian)
' Use a using statement to properly dispose of the OcrInput object
Using input = New OcrInput()
' Add a multi-language document to the OCR input
input.Add("multi-language.pdf")
' Read the document and get the OCR result
Dim Result = Ocr.Read(input)
' Save the result to a text file
Result.SaveAsTextFile("results.txt")
End Using
using IronOcr;using System.Drawing; // Assembly reference needed// Create a new instance of the IronTesseract OCR enginevarOcr = new IronTesseract();Ocr.Language = OcrLanguage.Mongolian;// Set OCR engine mode and configure for barcode readingOcr.Configuration.EngineMode = TesseractEngineMode.TesseractAndLstm;Ocr.Configuration.ReadBarCodes = true; //! Important// Use a using statement to properly dispose of the OcrInput objectusing (varInput = new OcrInput(@"images\sample.tiff")){ // Perform OCR and get the result OcrResultResult = Ocr.Read(Input); // Work with OCR result details varPages = Result.Pages; varWords = Pages[0].Words; varBarcodes = Result.Barcodes; // Explore the extensive and detailed API from here // - Page, block, paragraph, line, word, character details // - Image export, font coordinates, and statistics}
using IronOcr;
using System.Drawing; // Assembly reference needed
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Mongolian;
// Set OCR engine mode and configure for barcode reading
Ocr.Configuration.EngineMode = TesseractEngineMode.TesseractAndLstm;
Ocr.Configuration.ReadBarCodes = true; //! Important
// Use a using statement to properly dispose of the OcrInput object
using (var Input = new OcrInput(@"images\sample.tiff"))
{
// Perform OCR and get the result
OcrResult Result = Ocr.Read(Input);
// Work with OCR result details
var Pages = Result.Pages;
var Words = Pages[0].Words;
var Barcodes = Result.Barcodes;
// Explore the extensive and detailed API from here
// - Page, block, paragraph, line, word, character details
// - Image export, font coordinates, and statistics
}
ImportsIronOcrImportsSystem.Drawing' Assembly reference needed' Create a new instance of the IronTesseract OCR enginePrivateOcr = New IronTesseract()Ocr.Language = OcrLanguage.Mongolian' Set OCR engine mode and configure for barcode readingOcr.Configuration.EngineMode = TesseractEngineMode.TesseractAndLstmOcr.Configuration.ReadBarCodes = True '! Important' Use a using statement to properly dispose of the OcrInput objectUsingInput = New OcrInput("images\sample.tiff") ' Perform OCR and get the result DimResultAsOcrResult = Ocr.Read(Input) ' Work with OCR result details DimPages = Result.Pages DimWords = Pages(0).Words DimBarcodes = Result.Barcodes ' Explore the extensive and detailed API from here ' - Page, block, paragraph, line, word, character details ' - Image export, font coordinates, and statisticsEndUsing
Imports IronOcr
Imports System.Drawing ' Assembly reference needed
' Create a new instance of the IronTesseract OCR engine
Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.Mongolian
' Set OCR engine mode and configure for barcode reading
Ocr.Configuration.EngineMode = TesseractEngineMode.TesseractAndLstm
Ocr.Configuration.ReadBarCodes = True '! Important
' Use a using statement to properly dispose of the OcrInput object
Using Input = New OcrInput("images\sample.tiff")
' Perform OCR and get the result
Dim Result As OcrResult = Ocr.Read(Input)
' Work with OCR result details
Dim Pages = Result.Pages
Dim Words = Pages(0).Words
Dim Barcodes = Result.Barcodes
' Explore the extensive and detailed API from here
' - Page, block, paragraph, line, word, character details
' - Image export, font coordinates, and statistics
End Using
Curtis Chau hat einen Bachelor-Abschluss in Informatik von der Carleton University und ist spezialisiert auf Frontend-Entwicklung mit Expertise in Node.js, TypeScript, JavaScript und React. Leidenschaftlich widmet er sich der Erstellung intuitiver und ästhetisch ansprechender Benutzerschnittstellen und arbeitet gerne mit modernen Frameworks sowie der Erstellung gut strukturierter, optisch ansprechender Handbücher.