Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
Programming with LEADTOOLS WCF Services

LEADTOOLS WCF Services includes services for file loading and saving, image processing, document clean-up, reading and writing barcodes, and Optical Character Recognition (OCR).

Support for the following services is included:

  • Leadtools.Services.Raster - Used to convert images, as well as provide information about a given image (format, resolution, size, bits per pixel, page count, etc). The following services are exposed via this assembly:

    • RasterService.svc

  • Leadtools.Services.ImageProcessing - Used to perform image processing. These processing functions include flip, resize, autocrop, border remove, hole punch remove, deskew, rotate, smooth, sharpen, and many more. The following services are exposed via this assembly:

    • BatchService.svc

    • ColorProcessingService.svc

    • DocumentProcessingService.svc

    • EffectsProcessingService.svc

    • FiltersProcessingService.svc

    • ImageProcessingService.svc

  • Leadtools.Services.Forms – Used in performing Optical Character Recognition (OCR) operations. The following services are exposed via this assembly:

    • OcrService.svc

  • Leadtools.Services.Barcode - Used for reading and writing barcode data. The following services are exposed via this assembly:

    • BarcodeService.svc

In certain cases, you may want perform multiple image processing functions, one after another. The BatchService is useful in this case because it accepts a list of image processing functions, and executes them all within one call to the server. This saves time and bandwidth since there is only a single round trip to the server, not multiple trips for each function. To use multiple image processing functions, you must create an instance of the Requests class, add each image processing function as a RequestData object, and assign the collection to the BatchRequest.Requests Property.

Hosting Options

LEADTOOLS WCF can be hosted multiple ways including IIS, self hosting (managed applications only), windows service, and as a Windows Process Activation Service. For more information on hosting options, see Hosting WCF Services. LEADTOOLS also includes several tutorials for hosting and consuming WCF Services. For more information, see WCF Tutorials.

Configuring LEADTOOLS WCF Services

WCF, as well other features withing WCF such as OCR and Barcode must be unlocked in the toolkit. This unlocking is done in the below files:

  • Leadtools.Services.Forms.ServiceImplementations.dll.config

  • Leadtools.Services.ImageProcessing.ServiceImplementations.dll.config

  • Leadtools.Services.Raster.ServiceImplementations.dll.config

  • Leadtools.Services.Forms.ServiceImplementations.dll.config

Each configuration file contains a type of feature and its value. For each feature you have licensed, you will need to specify the corresponding unlock key. For example Leadtools.Services.Raster.ServiceImplementations.dll.config contains the following section:


<setting name="AbcKey" serializeAs="String">
   <value>YourKey</value>
</setting>

When specifying the OCR Engine to be used by Leadtools.Services.Forms, you must use the below setting in Leadtools.Services.Forms.ServiceImplementations.dll.config. This value currently supports "Advantage" for the Advantage Engine, "Professional" for the Professional Engine, or "Plus" for the Plus Engine.


<setting name="EngineType" serializeAs="String">
   <value>Advantage</value>
</setting>

Development Considerations:

When consuming WCF Services from web based applications (Silverlight and ASP.NET), Visual Studio will generate asynchronouse methods to the service, rather single synchronous calls. These asynchronous calls require you subscribe to the “Completed” event, call the method, and wait for the “Completed” event to fire. Below is an example of the necessary methods and events based on the RasterService.svc Convert Method:

Win-forms application – RasterServiceClient.Convert Method

Web application - RasterServiceClient.ConvertAsync Method, RasterServiceClient.ConvertCompleted

When calling LEADTOOLS WCF Services from a web application, it may be necessary to use a cross domain permissions files. For more information, please visit Making a Service Available Across Domain Boundaries.

See Also