Take the following steps to create an ASP.NET AJAX-Enabled Web Application to OCR an image. The pre-requisite for this tutorial is that you have LEADTOOLS WCF OcrService hosted.
For more information on hosting the WCF services see: How to Host LEADTOOLS Services on IIS 7 or How to Host LEADTOOLS Services on IIS 5 and 6.
Right-click on "Default.aspx" and select "View Code". Add the following lines to the beginning of the file:
Imports OcrServiceExample.OcrService
using OcrServiceExample.OcrService;
Switch to Design view and double click on the Button to generate an event handler. Copy and paste the code below in the Button1_Click event.
Dim loadData As FileBinaryData = New FileBinaryData()loadData.FileName = "C:\Users\Public\Documents\LEADTOOLS Images\OCR1.tif"Dim saveData As RawBinaryData = New RawBinaryData()' Set the conversation options.Dim convertOptions As DocumentConvertOptions = New DocumentConvertOptions()convertOptions.Format = OcrDocumentFormatType.TextAnsiconvertOptions.Source = loadDataconvertOptions.Destination = saveDataDim request As RecognizeRequest = New RecognizeRequest()request.ConvertOptions = convertOptionsDim svc As OcrService.OcrServiceClient = New OcrService.OcrServiceClient()TryDim response As RecognizeResponse = svc.Recognize(request)saveData = CType(IIf(TypeOf response.Destination Is RawBinaryData, response.Destination, Nothing), RawBinaryData)FinallyCType(svc, IDisposable).Dispose()End TryLabel1.Text = "<pre>" & System.Text.Encoding.ASCII.GetString(save.Data) & "</pre>"
FileBinaryData loadData = new FileBinaryData();loadData.FileName = @"C:\Users\Public\Documents\LEADTOOLS Images\OCR1.tif";RawBinaryData saveData = new RawBinaryData();// Set the conversion options.DocumentConvertOptions convertOptions = new DocumentConvertOptions();convertOptions.Format = OcrDocumentFormatType.TextAnsi;convertOptions.Source = loadData;convertOptions.Destination = saveData;RecognizeRequest request = new RecognizeRequest();request.ConvertOptions = convertOptions;using (OcrService.OcrServiceClient svc = new OcrService.OcrServiceClient()){RecognizeResponse response = svc.Recognize(request);saveData = response.Destination as RawBinaryData;}Label1.Text = "<pre>" + System.Text.Encoding.ASCII.GetString(saveData.Data) + "</pre>";
|
|

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.