←Select platform

AutoFormsParallelRunResultDynamicObjectCallback(object,AutoFormsRunResult,int,object) Delegate

Summary

Callback used to retrieve the result from the AutoFormsEngine for a dynamic input (file path string / LEADDocument / RasterImage).

Syntax

C#
C++/CLI
Python
public delegate void AutoFormsParallelRunResultDynamicObjectCallback( 
   object formObject, 
   AutoFormsRunResult result, 
   int itemIndex, 
   object userData 
) 
public: 
   delegate void AutoFormsParallelRunResultDynamicObjectCallback( 
      Object^ formObject, 
      AutoFormsRunResult^ result, 
      Int32 itemIndex, 
      Object^ userData 
   ) 
def AutoFormsParallelRunResultDynamicObjectCallback(self,formObject,result,itemIndex,userData): 
# formObject : Object, result : AutoFormsRunResult, itemIndex : Int32, userData : Object 

Parameters

formObject

The input item that was processed. One of these types: string file path, LEADDocument, or RasterImage.

result

The AutoFormsRunResult instance that contains the result.

itemIndex

The index of the processed item.

userData

The custom value obtained from either the on-demand getter method, or from the itemsUserData list.

Example

C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Forms.Common; 
using Leadtools.Forms.Auto; 
using Leadtools.Document; 
using Leadtools.Ocr; 
using Leadtools.Forms.Recognition; 
using Leadtools.Forms.Processing; 
using Leadtools.Barcode; 
 
using Leadtools.Forms; 
 
 
public void ResultCallbackDynamic4(object item, AutoFormsRunResult result, int itemIndex, object label) 
{ 
   if (result == null) 
   { 
      Console.WriteLine($"ERROR!!!: Failed to process {label}: [{itemIndex}]"); 
   } 
   else 
   { 
      Console.WriteLine($"Successfully processed {label}: [{itemIndex}]"); 
      foreach (FormPage page in result.FormFields) 
      { 
         foreach (FormField field in page) 
         { 
            Console.WriteLine($"Process for the field {field.Name} is {field.Result.Status} "); 
         } 
      } 
   } 
} 
 
 
public void ProcessFormsMultiProcessOnDemandDynamicObject(AutoFormsEngine autoEngine, List<string> fileNames, List<string> repositoryNames) 
{ 
   int nextItemIndex = -1; 
   var rng = new Random(); 
   RasterCodecs codecs = new RasterCodecs(); 
 
   AutoFormsParallelRunItemGetterDynamicObject getter = (ref object inputItem, ref object itemUserData, ref string repositoryName, object getterUserData) => 
   { 
      int index = Interlocked.Increment(ref nextItemIndex); 
 
      if (index >= fileNames.Count) 
         return; 
 
      double rand = rng.NextDouble(); 
 
      if (rand <= 0.33) 
      { 
         // Use file path 
         inputItem = fileNames[index]; 
      } 
      else if (rand <= 0.66) 
      { 
         // use LEADDocument 
         inputItem = DocumentFactory.LoadFromFile(fileNames[index], new LoadDocumentOptions()); 
      } 
      else 
      { 
         // use RasterImage 
 
         lock (codecs) 
         { 
            inputItem = codecs.Load(fileNames[index]); 
         } 
      } 
 
      repositoryName = repositoryNames == null ? null : repositoryNames[index]; 
   }; 
 
   autoEngine.RunParallelPipesOnDemandDynamicObject( 
       getter, 
       null, 
       ResultCallbackDynamic4, 
       8 
   ); 
 
   codecs.Dispose(); 
} 

Requirements

Target Platforms

See Also

Leadtools.Forms.Auto Namespace

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Forms.Auto Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.