ImageMan.Net Version 3 Summer 2012 Release
OcrPage Method
See Also  Example Send Feedback
DTI.ImageMan.OCR.Tesseract Namespace > Engine Class : OcrPage Method





img

Glossary Item Box

Scan this page and perform Optical Character Recognition.

Syntax

Visual Basic (Declaration) 
Public Function OcrPage( _
   ByVal img As ImImage _
) As System.String
Visual Basic (Usage)Copy Code
Dim instance As Engine
Dim img As ImImage
Dim value As System.String
 
value = instance.OcrPage(img)
C# 
public System.string OcrPage( 
   ImImage img
)
JScript 
public function OcrPage( 
   img : ImImage
) : System.String;
Managed Extensions for C++ 
public: System.string* OcrPage( 
   ImImage* img
) 
C++/CLI 
public:
System.String^ OcrPage( 
   ImImage^ img
) 

Parameters

img

Exceptions

ExceptionDescription
DTI.ImageMan.ImageProcessExceptionDTI.ImageMan.ImageProcessException

Remarks

The one necessary method, without this call the OCR engine is useless. The following code demonstrates a simple scan of a file and displays the results in a message box.
ocr = new Engine();
if (System.IO.File.Exists("phototest.tif")) {
        viewer1.Load("phototest.tif");
        String ocrTxt = ocr.OcrPage(viewer1.Images.CurrentImage);
        MessageBox.Show(ocrTxt);
}
If there is a critical error that prevents scanning this method will throw a DTI.ImageMan.ImageProcessException with critical exception information available in the string description of the error. More often than not this is a configuration issue, and a result of not having the configuration files set up correctly.

Example

The following code demonstrates a simple scan of a file and displays the results in a message box.
C#Copy Code
ocr = new Engine();
if (System.IO.File.Exists("phototest.tif")) {
	viewer1.Load("phototest.tif");
	String ocrTxt = ocr.OcrPage(viewer1.Images.CurrentImage);
	MessageBox.Show(ocrTxt);
}

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2014 Data Techniques, Inc. All Rights Reserved.