Case Studies
December 6, 2022
SanSaTek Testimonial
Sangkar Sari Teknologi is an international consultancy who are based in both Holland and Indonesia.
The C# OCR Library
// NuGet PM> Install-Package IronOcr
using IronOcr;
string imageText = new IronTesseract().Read(@"images\image.png").Text;
' NuGet PM> Install-Package IronOcr
Imports IronOcr
Private imageText As String = (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);
}
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput()
' OCR entire document
ocrInput.AddPdf("example.pdf", "password")
' Alternatively OCR selected page numbers
ocrInput.AddPdfPages("example.pdf", { 1, 2, 3 }, "password")
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
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);
}
}
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract()
ocrTesseract.Configuration.ReadBarCodes = True
Using ocrInput As New OcrInput("images\imageWithBarcode.png")
Dim ocrResult = ocrTesseract.Read(ocrInput)
For Each barcode In ocrResult.Barcodes
Console.WriteLine(barcode.Value)
Next barcode
End Using
//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);
}
'PM> Install-Package IronOcr.Languages.Arabic
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract()
ocrTesseract.Language = OcrLanguage.Arabic
Using ocrInput As New OcrInput("images\arabic.gif")
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
' Example with a Custom Trained Font Being used:
Dim ocrTesseractCustomerLang = New IronTesseract()
ocrTesseractCustomerLang.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata")
ocrTesseractCustomerLang.AddSecondaryLanguage(OcrLanguage.EnglishBest)
Using ocrInput As New OcrInput("images\mixed-lang.pdf")
Dim ocrResult = ocrTesseractCustomerLang.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
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);
}
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput("images\image.png")
ocrInput.Deskew()
ocrInput.DeNoise()
ocrInput.Despeckle()
ocrInput.EnhanceResolution(225)
ocrInput.Sharpen()
ocrInput.Erode()
ocrInput.Dilate()
ocrInput.Scale(200)
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
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);
}
Imports IronOcr
Imports System
Private 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 ocrInput As New OcrInput("images\image.png")
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
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.Pages)
{
page.SaveAsImage($"filtered_{page.Index}.bmp");
}
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract()
Using ocrInput As 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:
Dim confidence As Double
Dim codeToRun As String = OcrInputFilterWizard.Run("images\image.png", confidence, ocrTesseract)
Console.WriteLine(codeToRun)
' Optional: Export modified images so you can view them.
For Each page In ocrInput.Pages
page.SaveAsImage($"filtered_{page.Index}.bmp")
Next page
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
using IronOcr;
using IronSoftware.Drawing;
using System;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput("blue_and_pink.png"))
{
ocrInput.WithTitle("Recolored");
ocrInput.ReplaceColor(Color.Pink, Color.White, 10);
// Pink detection has 10% tolerance
ocrInput.ReplaceColor(Color.Blue, Color.Black, 5);
// Blue detection has 5% tolerance
// Export the modified image so you can manually inspect it.
foreach (var page in ocrInput.Pages)
{
page.SaveAsImage($"black_and_white_page_{page.Index}.bmp");
}
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports IronSoftware.Drawing
Imports System
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput("blue_and_pink.png")
ocrInput.WithTitle("Recolored")
ocrInput.ReplaceColor(Color.Pink, Color.White, 10)
' Pink detection has 10% tolerance
ocrInput.ReplaceColor(Color.Blue, Color.Black, 5)
' Blue detection has 5% tolerance
' Export the modified image so you can manually inspect it.
For Each page In ocrInput.Pages
page.SaveAsImage($"black_and_white_page_{page.Index}.bmp")
Next page
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
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;
}
}
}
}
}
}
Imports IronOcr
Imports 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/
Private ocrTesseract = New IronTesseract()
ocrTesseract.Configuration.ReadBarCodes = True
Using ocrInput As New OcrInput("example.tiff")
Dim ocrResult As OcrResult = ocrTesseract.Read(ocrInput)
For Each page In ocrResult.Pages
' Page object
Dim PageNumber As Integer = page.PageNumber
Dim PageText As String = page.Text
Dim PageWordCount As Integer = page.WordCount
' null if we dont set Ocr.Configuration.ReadBarCodes = true;
Dim Barcodes() As OcrResult.Barcode = page.Barcodes
Dim PageImage As AnyBitmap = page.ToBitmap(ocrInput)
Dim PageWidth As Integer = page.Width
Dim PageHeight As Integer = page.Height
Dim PageRotation As Double = page.Rotation ' angular correction in degrees from OcrInput.Deskew()
For Each paragraph In page.Paragraphs
' Pages -> Paragraphs
Dim ParagraphNumber As Integer = paragraph.ParagraphNumber
Dim ParagraphText As String = paragraph.Text
Dim ParagraphImage As AnyBitmap = paragraph.ToBitmap(ocrInput)
Dim ParagraphX_location As Integer = paragraph.X
Dim ParagraphY_location As Integer = paragraph.Y
Dim ParagraphWidth As Integer = paragraph.Width
Dim ParagraphHeight As Integer = paragraph.Height
Dim ParagraphOcrAccuracy As Double = paragraph.Confidence
Dim paragrapthText_direction As OcrResult.TextFlow = paragraph.TextDirection
For Each line In paragraph.Lines
' Pages -> Paragraphs -> Lines
Dim LineNumber As Integer = line.LineNumber
Dim LineText As String = line.Text
Dim LineImage As AnyBitmap = line.ToBitmap(ocrInput)
Dim LineX_location As Integer = line.X
Dim LineY_location As Integer = line.Y
Dim LineWidth As Integer = line.Width
Dim LineHeight As Integer = line.Height
Dim LineOcrAccuracy As Double = line.Confidence
Dim LineSkew As Double = line.BaselineAngle
Dim LineOffset As Double = line.BaselineOffset
For Each word In line.Words
' Pages -> Paragraphs -> Lines -> Words
Dim WordNumber As Integer = word.WordNumber
Dim WordText As String = word.Text
Dim WordImage As AnyBitmap = word.ToBitmap(ocrInput)
Dim WordX_location As Integer = word.X
Dim WordY_location As Integer = word.Y
Dim WordWidth As Integer = word.Width
Dim WordHeight As Integer = word.Height
Dim WordOcrAccuracy As Double = word.Confidence
For Each character In word.Characters
' Pages -> Paragraphs -> Lines -> Words -> Characters
Dim CharacterNumber As Integer = character.CharacterNumber
Dim CharacterText As String = character.Text
Dim CharacterImage As AnyBitmap = character.ToBitmap(ocrInput)
Dim CharacterX_location As Integer = character.X
Dim CharacterY_location As Integer = character.Y
Dim CharacterWidth As Integer = character.Width
Dim CharacterHeight As Integer = character.Height
Dim CharacterOcrAccuracy As Double = character.Confidence
' Output alternative symbols choices and their probability.
' Very useful for spellchecking
Dim Choices() As OcrResult.Choice = character.Choices
Next character
Next word
Next line
Next paragraph
Next page
End Using
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");
}
Imports IronOcr
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput()
ocrInput.AddImage("images\page1.png")
ocrInput.AddImage("images\page2.bmp")
ocrInput.AddImage("images\page3.tiff")
ocrInput.Deskew()
Dim ocrResult = ocrTesseract.Read(ocrInput)
ocrResult.SaveAsSearchablePdf("searchable.pdf")
End Using
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);
}
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract()
' This is done by default and can be omitted:
' ocrTesseract.Configuration.TesseractVersion = TesseractVersion.Tesseract5;
Using ocrInput As New OcrInput("images\image.png")
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
using IronOcr;
using System;
var ocrTesseract = new IronTesseract()
{
Language = OcrLanguage.EnglishBest,
Configuration = new TesseractConfiguration()
{
ReadBarCodes = false,
BlackListCharacters = "`ë|^",
RenderSearchablePdfsAndHocr = true,
PageSegmentationMode = TesseractPageSegmentationMode.AutoOsd,
}
};
using (var ocrInput = new OcrInput(@"images\image.png"))
{
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract() With {
.Language = OcrLanguage.EnglishBest,
.Configuration = New TesseractConfiguration() With {
.ReadBarCodes = False,
.BlackListCharacters = "`ë|^",
.RenderSearchablePdfsAndHocr = True,
.PageSegmentationMode = TesseractPageSegmentationMode.AutoOsd
}
}
Using ocrInput As New OcrInput("images\image.png")
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput(@"images\image.png"))
{
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput("images\image.png")
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
using IronOcr;
using IronSoftware.Drawing;
using System;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput())
{
// A 41% improvement on speed by specifiying a pixel region
var ContentArea = new CropRectangle(x: 215, y: 1250, width: 1335, height: 280);
ocrInput.AddImage("img/example.png", ContentArea);
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports IronSoftware.Drawing
Imports System
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput()
' A 41% improvement on speed by specifiying a pixel region
Dim ContentArea = New CropRectangle(x:= 215, y:= 1250, width:= 1335, height:= 280)
ocrInput.AddImage("img/example.png", ContentArea)
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
using IronOcr;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput())
{
ocrInput.AddMultiFrameTiff("images/multiframe.tiff");
var ocrResult = ocrTesseract.Read(ocrInput);
ocrResult.SaveAsSearchablePdf("searchable.pdf");
}
Imports IronOcr
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput()
ocrInput.AddMultiFrameTiff("images/multiframe.tiff")
Dim ocrResult = ocrTesseract.Read(ocrInput)
ocrResult.SaveAsSearchablePdf("searchable.pdf")
End Using
using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput(@"images\image.png"))
{
ocrInput.TargetDPI = 300;
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput("images\image.png")
ocrInput.TargetDPI = 300
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
using IronOcr;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput())
{
ocrInput.AddPdf("scan.pdf");
// Image processing is automatically multi-threaded
ocrInput.Deskew();
// OCR reading is automatically multi-threaded too
var ocrResult = ocrTesseract.Read(ocrInput);
}
Imports IronOcr
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput()
ocrInput.AddPdf("scan.pdf")
' Image processing is automatically multi-threaded
ocrInput.Deskew()
' OCR reading is automatically multi-threaded too
Dim ocrResult = ocrTesseract.Read(ocrInput)
End Using
using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
ocrTesseract.OcrProgress += (_, ocrProgressEventsArgs) =>
{
Console.WriteLine(ocrProgressEventsArgs.ProgressPercent + "% " + ocrProgressEventsArgs.Duration.TotalSeconds + "s");
};
using (var input = new OcrInput("large.pdf"))
{
// Progress events will fire during the read operation even if the main thread is blocked.
var result = ocrTesseract.Read(input);
}
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract()
Private ocrTesseract.OcrProgress += Sub(underscore, ocrProgressEventsArgs)
Console.WriteLine(ocrProgressEventsArgs.ProgressPercent & "% " & ocrProgressEventsArgs.Duration.TotalSeconds & "s")
End Sub
Using input = New OcrInput("large.pdf")
' Progress events will fire during the read operation even if the main thread is blocked.
Dim result = ocrTesseract.Read(input)
End Using
using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput())
{
ocrInput.AddMultiFrameTiff("images/multiframe.tiff");
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput()
ocrInput.AddMultiFrameTiff("images/multiframe.tiff")
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
using IronOcr;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput())
{
ocrInput.AddPdf("scan.pdf", "password");
// Clean up twisted pages
ocrInput.Deskew();
var ocrResult = ocrTesseract.Read(ocrInput);
ocrResult.SaveAsSearchablePdf("searchable.pdf");
}
Imports IronOcr
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput()
ocrInput.AddPdf("scan.pdf", "password")
' Clean up twisted pages
ocrInput.Deskew()
Dim ocrResult = ocrTesseract.Read(ocrInput)
ocrResult.SaveAsSearchablePdf("searchable.pdf")
End Using
using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
ocrTesseract.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata");
using (var ocrInput = new OcrInput(@"images\image.png"))
{
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract()
ocrTesseract.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata")
Using ocrInput As New OcrInput("images\image.png")
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
//PM> Install-Package IronOcr.Languages.Arabic
//PM> Install-Package IronOcr.Languages.Chinese
using IronOcr;
using System;
var Ocr = new IronTesseract();
// Add a primary language (Default is English)
Ocr.Language = OcrLanguage.English;
// Add as many secondary languages as you like
Ocr.AddSecondaryLanguage(OcrLanguage.Arabic);
Ocr.AddSecondaryLanguage(OcrLanguage.ChineseSimplified);
using (var Input = new OcrInput(@"images\image.png"))
{
var Result = Ocr.Read(Input);
Console.WriteLine(Result.Text);
}
'PM> Install-Package IronOcr.Languages.Arabic
'PM> Install-Package IronOcr.Languages.Chinese
Imports IronOcr
Imports System
Private Ocr = New IronTesseract()
' Add a primary language (Default is English)
Ocr.Language = OcrLanguage.English
' Add as many secondary languages as you like
Ocr.AddSecondaryLanguage(OcrLanguage.Arabic)
Ocr.AddSecondaryLanguage(OcrLanguage.ChineseSimplified)
Using Input = New OcrInput("images\image.png")
Dim Result = Ocr.Read(Input)
Console.WriteLine(Result.Text)
End Using
using IronOcr;
using IronSoftware.Drawing;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput(@"images\image.png"))
{
var ocrResult = ocrTesseract.Read(ocrInput);
foreach (var page in ocrResult.Pages)
{
foreach (var word in page.Words)
{
word.ToBitmap(ocrInput).SaveAs($"page{page.PageNumber}_word{word.WordNumber}.png", AnyBitmap.ImageFormat.Png);
}
}
}
Imports IronOcr
Imports IronSoftware.Drawing
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput("images\image.png")
Dim ocrResult = ocrTesseract.Read(ocrInput)
For Each page In ocrResult.Pages
For Each word In page.Words
word.ToBitmap(ocrInput).SaveAs($"page{page.PageNumber}_word{word.WordNumber}.png", AnyBitmap.ImageFormat.Png)
Next word
Next page
End Using
December 6, 2022
SanSaTek Testimonial
Sangkar Sari Teknologi is an international consultancy who are based in both Holland and Indonesia.
Install-Package IronOcr
Have a question? Get in touch with our development team.
Want to deploy IronOCR to a live project for FREE?
Want to deploy IronOCR to a live project for FREE?
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