The
RecognizeRequest object provides options for the
Leadtools.Services.Forms.ServiceContracts.IOcrService.Recognize operation.
Object Model
Syntax
Visual Basic (Declaration) | |
---|
<DataContractAttribute(Namespace="http://Leadtools.Services.Forms.DataContracts/2009/01", Name="RecognizeRequest")>
Public Class RecognizeRequest |
C# | |
---|
[DataContractAttribute(Namespace="http://Leadtools.Services.Forms.DataContracts/2009/01", Name="RecognizeRequest")]
public class RecognizeRequest |
C++/CLI | |
---|
[DataContractAttribute(Namespace="http://Leadtools.Services.Forms.DataContracts/2009/01", Name="RecognizeRequest")]
public ref class RecognizeRequest |
Example
Visual Basic | Copy Code |
---|
Public Sub DocumentConvertOptionsExample()
Dim client As OcrServiceClient = New OcrServiceClient()
Dim sourceBinaryData As RawBinaryData = New RawBinaryData()
sourceBinaryData.Data = File.ReadAllBytes(LeadtoolsExamples.Common.ImagesPath.Path & "clean.tif")
Dim convertOptions As DocumentConvertOptions = New DocumentConvertOptions()
convertOptions.Source = sourceBinaryData
convertOptions.Destination = Nothing
convertOptions.Format = OcrDocumentFormatType.TextAnsi
convertOptions.FirstPageNumber = 1
convertOptions.LastPageNumber = 1
Dim files As DocumentFiles
Dim request As RecognizeRequest = New RecognizeRequest()
request.ConvertOptions = convertOptions
Dim response As RecognizeResponse = client.Recognize(request)
If Not response.Destination Is Nothing Then
If TypeOf response.Destination Is RawBinaryData Then
File.WriteAllBytes(LeadtoolsExamples.Common.ImagesPath.Path & "clean.txt", (TryCast(response.Destination, RawBinaryData)).Data)
End If
End If
client.Close()
End Sub |
C# | Copy Code |
---|
public void DocumentConvertOptionsExample() { OcrServiceClient client = new OcrServiceClient(); RawBinaryData sourceBinaryData = new RawBinaryData(); sourceBinaryData.Data = File.ReadAllBytes(LeadtoolsExamples.Common.ImagesPath.Path + "clean.tif"); // set the document convertion options DocumentConvertOptions convertOptions = new DocumentConvertOptions(); convertOptions.Source = sourceBinaryData; convertOptions.Destination = null; convertOptions.Format = OcrDocumentFormatType.TextAnsi; convertOptions.FirstPageNumber = 1; convertOptions.LastPageNumber = 1; DocumentFiles files; RecognizeRequest request = new RecognizeRequest(); request.ConvertOptions = convertOptions; RecognizeResponse response = client.Recognize(request); if (response.Destination != null) { if (response.Destination is RawBinaryData) File.WriteAllBytes(LeadtoolsExamples.Common.ImagesPath.Path + "clean.txt", (response.Destination as RawBinaryData).Data); } client.Close(); } |
Inheritance Hierarchy
System.Object
Leadtools.Services.Forms.DataContracts.RecognizeRequest
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also