Runs the AutoFormsEngine
on demand for LEADDocument instances.
public void RunParallelPipesOnDemand(
AutoFormsParallelRunItemGetterLeadDocument leadDocsGetter,
object getterUserData,
AutoFormsParallelRunResultLEADDocumentCallback callback,
int pipesCount
)
leadDocsGetter
Callback to get the LEADDocument instance.
getterUserData
Optional object to be passed to the getter.
callback
Callback called for each input file 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 ResultCallbackDocument2(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 ProcessFormsMultiProcessOnDemandDocuments(AutoFormsEngine autoEngine, List<string> fileNames, List<string> repositoryNames)
{
int nextItemIndex = -1;
AutoFormsParallelRunItemGetterLeadDocument getter = (ref LEADDocument leadDoc, ref object itemUserData, ref string repositoryName, object getterUserData) =>
{
int index = Interlocked.Increment(ref nextItemIndex);
if (index >= fileNames.Count)
return;
leadDoc = DocumentFactory.LoadFromFile(fileNames[index], new LoadDocumentOptions());
repositoryName = repositoryNames == null ? null : repositoryNames[index];
};
autoEngine.RunParallelPipesOnDemand(
getter,
null,
ResultCallbackDocument2,
8
);
}