Runs the AutoFormsEngine
on a list of LEADDocument instances in parallel.
public void RunParallelPipesForList(
List<LEADDocument> leadDocs,
AutoFormsParallelRunResultLEADDocumentCallback callback,
List<object> itemsUserData,
List<string> repositoryNames,
int pipesCount
)
leadDocs
List of LEADDocument instances.
callback
Callback called for each input document after processing.
itemsUserData
Optional list of custom data objects associated to each LEADDocument instance.
repositoryNames
Optional List. If the corresponding repository name of item is not null, then RunParallelPipesForList uses it in place of the current value of FullTextSearchRepositoryName.
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 ResultCallbackDocument(LEADDocument document, AutoFormsRunResult result, int itemIndex, object label)
{
if (result == null)
{
Console.WriteLine($"ERROR!!!: Failed to process {label}: [{itemIndex}] {document.Name}");
}
else
{
Console.WriteLine($"Successfully processed {label}: [{itemIndex}] {document.Name}");
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 ProcessFormsMultiProcessListDocuments(AutoFormsEngine autoEngine, List<string> fileNames, List<string> repositoryNames)
{
List<string> labels = fileNames.Select(fn => fn.Split('/', '\\').Last()).ToList();
List<object> labels_AsCustomDataList = labels.Select(label => label as object).ToList();
List<LEADDocument> documents = fileNames.Select(fn => DocumentFactory.LoadFromFile(fn, new LoadDocumentOptions() { })).ToList();
autoEngine.RunParallelPipesForList(
documents,
ResultCallbackDocument,
labels_AsCustomDataList,
repositoryNames,
8
);
}