Take the following steps to start a project and to add some code that demonstrates how to recognize zones:
Start with the program you created in OCR Tutorial - Working with Pages
Drag and drop a button in Form1. Leave the button name as the default "button6", then change the Text property of the button to the following:
ButtonTextbutton6Recognize and Save
Add the following code for the button6 (Recognize and Save) Click
handler:
private void button6_Click(object sender, EventArgs e)
{
// Recognize all the pages we have
// Note, we do not have to call AutoZone, the engine
// will check if the page(s) have not been zoned and perform
// auto-zoning for us automatically
_ocrDocument.Pages.Recognize(null);
// Prompt the user for a PDF file
string fileName = null;
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.Filter = "PDF files|*.pdf|All files|*.*";
dlg.DefaultExt = "pdf";
if (dlg.ShowDialog(this) == DialogResult.OK)
fileName = dlg.FileName;
}
if (fileName == null)
return;
// Save the result as a PDF file
_ocrDocument.Save(fileName, DocumentFormat.Pdf, null);
// Show the PDF file we just saved
System.Diagnostics.Process.Start(fileName);
}
Private Sub button6_Click(sender As Object, e As EventArgs)
' Recognize all the pages we have
' Note, we do not have to call AutoZone, the engine
' will check if the page(s) have not been zoned and perform
' auto-zoning for us automatically
_ocrDocument.Pages.Recognize(Nothing)
' Prompt the user for a PDF file
Dim fileName As String = Nothing
Using dlg As New SaveFileDialog()
dlg.Filter = "PDF files|*.pdf|All files|*.*"
dlg.DefaultExt = "pdf"
If (dlg.ShowDialog(Me) = DialogResult.OK) Then
fileName = dlg.FileName
End If
End Using
If IsNothing(fileName) Then Return
' Save the result as a PDF file
_ocrDocument.Save(fileName, DocumentFormat.Pdf, Nothing)
' Show the PDF file we just saved
System.Diagnostics.Process.Start(fileName)
End Sub
Build, and Run the program to test it. You can click the buttons in the following order to create the PDF file "Startup", "Add Page", "Save and Recognize", "Shutdown".
Save this project to use for testing other code samples.
OCR Tutorial - Working with Pages
OCR Tutorial - Adding and Painting Zones
OCR Tutorial - Working with Recognition Results
OCR Tutorial - Scanning to Searchable PDF
Getting Started (Guide to Example Programs)
Programming with LEADTOOLS .NET OCR
An Overview of OCR Recognition Modules
Creating an OCR Engine Instance
Starting and Shutting Down the OCR Engine
Multi-Threading with LEADTOOLS OCR
OCR Spell Language Dictionaries
Using OMR in LEADTOOLS .NET OCR
Products |
Support |
Feedback: OCR Tutorial - Recognizing Pages |
Introduction |
Help Version 19.0.2017.6.21
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.