LEADTOOLS WCF OCR (Leadtools.Services.Forms.DataContracts assembly)

ConvertOptions Property

Show in webframe
Example 





Gets or sets the DocumentConvertOptions object which controls the conversion from image to document.
Syntax
[DataMemberAttribute(Name="ConvertOptions", IsRequired=true)]
public DocumentConvertOptions ConvertOptions {get; set;}
'Declaration
 
<DataMemberAttribute(Name="ConvertOptions", IsRequired=True)>
Public Property ConvertOptions As DocumentConvertOptions
'Usage
 
Dim instance As RecognizeRequest
Dim value As DocumentConvertOptions
 
instance.ConvertOptions = value
 
value = instance.ConvertOptions

            

            
[DataMemberAttribute(Name="ConvertOptions", IsRequired=true)]
public:
property DocumentConvertOptions ConvertOptions {
   DocumentConvertOptions get();
   void set (    DocumentConvertOptions value);
}

Property Value

A DocumentConvertOptions structure which controls the conversion from image to document.
Remarks
Set this property before calling the Leadtools.Services.Forms.ServiceContracts.IOcrService.Recognize method.
Example
Copy Code  
Imports Leadtools.Services
Imports Leadtools.Services.Forms.ServiceContracts
Imports Leadtools.Services.Forms.ServiceImplementations
Imports leadtools.services.forms.datacontracts._2009._01

Public Sub DocumentConvertOptionsExample()
   Dim client As OcrServiceClient = New OcrServiceClient()
   Dim sourceBinaryData As RawBinaryData = New RawBinaryData()
   sourceBinaryData.Data = File.ReadAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "clean.tif"))

   ' set the document convertion options
   Dim convertOptions As DocumentConvertOptions = New DocumentConvertOptions()

   convertOptions.Source = sourceBinaryData
   convertOptions.Destination = Nothing
   convertOptions.Format = OcrDocumentFormatType.TextAnsi
   convertOptions.FirstPageNumber = 1
   convertOptions.LastPageNumber = 1

   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(Path.Combine(LEAD_VARS.ImagesDir, "clean.txt"), (TryCast(response.Destination, RawBinaryData)).Data)
      End If
   End If

   client.Close()
End Sub

Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools.Services;
using Leadtools.Services.Forms.ServiceContracts;
using Leadtools.Services.Forms.ServiceImplementations;
using leadtools.services.forms.datacontracts._2009._01;

public void DocumentConvertOptionsExample()
{
   OcrServiceClient client = new OcrServiceClient();
   RawBinaryData sourceBinaryData = new RawBinaryData();
   sourceBinaryData.Data = File.ReadAllBytes(Path.Combine(LEAD_VARS.ImagesDir,"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;

   RecognizeRequest request = new RecognizeRequest();
   request.ConvertOptions = convertOptions;

   RecognizeResponse response = client.Recognize(request);

   if (response.Destination != null)
   {
      if (response.Destination is RawBinaryData)
         File.WriteAllBytes(Path.Combine(LEAD_VARS.ImagesDir,"clean.txt"), (response.Destination as RawBinaryData).Data);
   }

   client.Close();
}

static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Requirements

Target Platforms

See Also

Reference

RecognizeRequest Class
RecognizeRequest Members

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

Applications developed with LEADTOOLS WCF components require runtime licenses. Server licensing is required for applications on a server. For more information, refer to: Imaging Pro/Document/Medical