Runs the AutoFormsEngine
on demand for RasterImage instances.
public void RunParallelPipesOnDemand(
AutoFormsParallelRunItemGetterRasterImage imagesGetter,
object getterUserData,
AutoFormsParallelRunResultRasterImageCallback callback,
int pipesCount
)
imagesGetter
Callback to get the RasterImage instance.
getterUserData
Optional object to be passed to the getter.
callback
Callback for each input image after processing.
pipesCount
Number of parallel threads used to consume the input data.
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 ResultCallbackImage3(RasterImage image, 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 ProcessFormsMultiProcessOnDemandImages(AutoFormsEngine autoEngine, List<string> fileNames, List<string> repositoryNames)
{
int nextItemIndex = -1;
RasterCodecs codecs = new RasterCodecs();
AutoFormsParallelRunItemGetterRasterImage getter = (ref RasterImage image, ref object itemUserData, ref string repositoryName, object getterUserData) =>
{
int index = Interlocked.Increment(ref nextItemIndex);
if (index >= fileNames.Count)
return;
lock (codecs)
{
image = codecs.Load(fileNames[index]);
}
repositoryName = repositoryNames == null ? null : repositoryNames[index];
};
autoEngine.RunParallelPipesOnDemand(
getter,
null,
ResultCallbackImage3,
8
);
codecs.Dispose();
}