Fully-functional product
Get 30 days of fully-functional product.
Have it up and running in minutes.
Or download the DLL directly here
// NuGet PM> Install-Package IronOcr
using IronOcr;
string imageText = new IronTesseract().Read(@"images\image.png").Text;
using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput())
{
// OCR entire document
ocrInput.AddPdf("example.pdf", "password");
// Alternatively OCR selected page numbers
ocrInput.AddPdfPages("example.pdf", new[] { 1, 2, 3 }, "password");
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
ocrTesseract.Configuration.ReadBarCodes = true;
using (var ocrInput = new OcrInput(@"images\imageWithBarcode.png"))
{
var ocrResult = ocrTesseract.Read(ocrInput);
foreach (var barcode in ocrResult.Barcodes)
{
Console.WriteLine(barcode.Value);
}
}
//PM> Install-Package IronOcr.Languages.Arabic
using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
ocrTesseract.Language = OcrLanguage.Arabic;
using (var ocrInput = new OcrInput(@"images\arabic.gif"))
{
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
// Example with a Custom Trained Font Being used:
var ocrTesseractCustomerLang = new IronTesseract();
ocrTesseractCustomerLang.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata");
ocrTesseractCustomerLang.AddSecondaryLanguage(OcrLanguage.EnglishBest);
using (var ocrInput = new OcrInput(@"images\mixed-lang.pdf"))
{
var ocrResult = ocrTesseractCustomerLang.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput(@"images\image.png"))
{
ocrInput.Deskew();
ocrInput.DeNoise();
ocrInput.Despeckle();
ocrInput.EnhanceResolution(225);
ocrInput.Sharpen();
ocrInput.Erode();
ocrInput.Dilate();
ocrInput.Scale(200);
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
// Fast Dictionary
ocrTesseract.Language = OcrLanguage.EnglishFast;
// Turn off unneeded options
ocrTesseract.Configuration.ReadBarCodes = false;
ocrTesseract.Configuration.RenderSearchablePdfsAndHocr = false;
// Assume text is laid out neatly in an orthogonal document
ocrTesseract.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto;
using (var ocrInput = new OcrInput(@"images\image.png"))
{
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput(@"images\image.png"))
{
// Note: You don't need all of them; most users only need Deskew() and occasionally DeNoise()
ocrInput.WithTitle("My Document");
ocrInput.Binarize();
ocrInput.Contrast();
ocrInput.Deskew();
ocrInput.DeNoise();
ocrInput.Despeckle();
ocrInput.Dilate();
ocrInput.EnhanceResolution(300);
ocrInput.Invert();
ocrInput.Rotate(90);
ocrInput.Scale(150);
ocrInput.Sharpen();
ocrInput.ToGrayScale();
ocrInput.Erode();
// WIZARD - If you are unsure use the debug-wizard to test all combinations:
string codeToRun = OcrInputFilterWizard.Run(@"images\image.png", out double confidence, ocrTesseract);
Console.WriteLine(codeToRun);
// Optional: Export modified images so you can view them.
foreach (var page in ocrInput.GetPages())
{
page.SaveAsImage($"filtered_{page.Index}.bmp");
}
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
using IronOcr;
using IronSoftware.Drawing;
// We can delve deep into OCR results as an object model of
// Pages, Barcodes, Paragraphs, Lines, Words and Characters
// This allows us to explore, export and draw OCR content using other APIs/
var ocrTesseract = new IronTesseract();
ocrTesseract.Configuration.ReadBarCodes = true;
using (var ocrInput = new OcrInput(@"example.tiff"))
{
OcrResult ocrResult = ocrTesseract.Read(ocrInput);
foreach (var page in ocrResult.Pages)
{
// Page object
int PageNumber = page.PageNumber;
string PageText = page.Text;
int PageWordCount = page.WordCount;
// null if we dont set Ocr.Configuration.ReadBarCodes = true;
OcrResult.Barcode[] Barcodes = page.Barcodes;
AnyBitmap PageImage = page.ToBitmap(ocrInput);
int PageWidth = page.Width;
int PageHeight = page.Height;
double PageRotation = page.Rotation; // angular correction in degrees from OcrInput.Deskew()
foreach (var paragraph in page.Paragraphs)
{
// Pages -> Paragraphs
int ParagraphNumber = paragraph.ParagraphNumber;
string ParagraphText = paragraph.Text;
AnyBitmap ParagraphImage = paragraph.ToBitmap(ocrInput);
int ParagraphX_location = paragraph.X;
int ParagraphY_location = paragraph.Y;
int ParagraphWidth = paragraph.Width;
int ParagraphHeight = paragraph.Height;
double ParagraphOcrAccuracy = paragraph.Confidence;
OcrResult.TextFlow paragrapthText_direction = paragraph.TextDirection;
foreach (var line in paragraph.Lines)
{
// Pages -> Paragraphs -> Lines
int LineNumber = line.LineNumber;
string LineText = line.Text;
AnyBitmap LineImage = line.ToBitmap(ocrInput);
int LineX_location = line.X;
int LineY_location = line.Y;
int LineWidth = line.Width;
int LineHeight = line.Height;
double LineOcrAccuracy = line.Confidence;
double LineSkew = line.BaselineAngle;
double LineOffset = line.BaselineOffset;
foreach (var word in line.Words)
{
// Pages -> Paragraphs -> Lines -> Words
int WordNumber = word.WordNumber;
string WordText = word.Text;
AnyBitmap WordImage = word.ToBitmap(ocrInput);
int WordX_location = word.X;
int WordY_location = word.Y;
int WordWidth = word.Width;
int WordHeight = word.Height;
double WordOcrAccuracy = word.Confidence;
foreach (var character in word.Characters)
{
// Pages -> Paragraphs -> Lines -> Words -> Characters
int CharacterNumber = character.CharacterNumber;
string CharacterText = character.Text;
AnyBitmap CharacterImage = character.ToBitmap(ocrInput);
int CharacterX_location = character.X;
int CharacterY_location = character.Y;
int CharacterWidth = character.Width;
int CharacterHeight = character.Height;
double CharacterOcrAccuracy = character.Confidence;
// Output alternative symbols choices and their probability.
// Very useful for spellchecking
OcrResult.Choice[] Choices = character.Choices;
}
}
}
}
}
}
using IronOcr;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput())
{
ocrInput.AddImage(@"images\page1.png");
ocrInput.AddImage(@"images\page2.bmp");
ocrInput.AddImage(@"images\page3.tiff");
ocrInput.Deskew();
var ocrResult = ocrTesseract.Read(ocrInput);
ocrResult.SaveAsSearchablePdf("searchable.pdf");
}
using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
// This is done by default and can be omitted:
// ocrTesseract.Configuration.TesseractVersion = TesseractVersion.Tesseract5;
using (var ocrInput = new OcrInput(@"images\image.png"))
{
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
Install-Package IronOcr
Have a question? Get in touch with our development team.
Want to deploy IronOCR to a live project for FREE?
Your trial key should be in the email.The trial form was submitted
successfully.
If it is not, please contact
support@ironsoftware.com
Want to deploy IronOCR to a live project for FREE?
Your trial key should be in the email.The trial form was submitted
successfully.
If it is not, please contact
support@ironsoftware.com
Get started for FREE
No credit card required
Get 30 days of fully-functional product.
Have it up and running in minutes.
Test and share in a live environment.
Works wherever you need it to.
No watermarks in production.
No limits.
No credit card or account creation required
Your trial key should be in the email.
If it is not, please contact
support@ironsoftware.com
Get started for FREE
No credit card required
Get 30 days of fully-functional product.
Have it up and running in minutes.
Test and share in a live environment.
Works wherever you need it to.
No watermarks in production.
No limits.
Licenses from $749. Have a question? Get in touch.
Fully-functional product, get the key instantly
Thank you!
Your license key has been delivered to the email provided. Contact us
24-Hour Upgrade Offer:
Save 50% on a
Professional Upgrade
Go Professional to cover 10 developers
and unlimited projects.
hours
:
minutes
:
seconds
Professional
$600 USD
$299 USD
5 .NET Products for the Price of 2
Total Suite Value:
$7,192 USD
Upgrade price
TODAY
ONLY
$499 USD
After 24 Hrs
$1,098 USD