AVAILABLE NOW: Spring 2025 Release
By Apryse | 2025 May 19
5 min
Tags
C#
automation
Vendor consolidation
When working in a paperless office, businesses receive hundreds of different forms and invoices from different vendors. It is often a major pain point and bottleneck to manually find, extract, and store all the necessary information. Thankfully with the Apryse SDK and our patented Forms Recognition technology, everything can be easily automated to improve workflow productivity and efficiency.
With Apryse, users need only to create templates, also known as master forms, for each of the different invoices or form types. These master forms are then stored in a repository and used to automatically recognize which type of filled form is currently being processed.
In the demonstration below, we take a directory of filled forms and compare them to a list of master forms. We will first load the master forms. Next, we’ll cycle through each of the forms in the directory and compare them to the master forms. If a form can’t be classified, you’ll see a warning. Otherwise, you’ll see the name and type of the classified form.
private static void RecognizeForms()
{
Console.WriteLine("Loading Templates...");
using TemplatesCollection templates = new TemplatesCollection.Builder()
.FromSourceFolder(templatesDirectory)
.Build();
Console.WriteLine("Creating Classifier...");
using TemplateClassifier classifier = new TemplateClassifier.Builder()
.SetTemplatesSource(templates)
.SetRuntimeFolder(@".\TemplateExtraction1.0\Runtimes")
.SetLicense([license, licenseKey])
.Build();
Console.WriteLine("Creating Extractor...");
using TemplateExtractor extractor = new TemplateExtractor.Builder()
.SetTemplatesSource(templates)
.SetRuntimeFolder(@".\TemplateExtraction1.0\Runtimes")
.SetLicense([license, licenseKey])
.Build();
Console.WriteLine("Begin recognizing forms...\n");
string[] formsToRecognize = Directory.GetFiles(filledFormsDirectory, "*.pdf", SearchOption.AllDirectories);
foreach (string form in formsToRecognize)
{
using var fileStream = new FileStream(form, FileMode.Open, FileAccess.Read, FileShare.Read);
var inputStream = new InputStream(fileStream);
Result<ClassifyResult> classifyResult = classifier.Classify(inputStream);
if (!classifyResult.IsSuccess)
{
Console.WriteLine("Unable to classify file...");
}
else
{
Console.WriteLine($"Form {Path.GetFileName(form)} has been recognized as a {classifyResult.Value.ClassName}");
}
}
Download the Apryse SDK for free. It’s fully functional and comes with free chat and email support.
Stay tuned for more conversion examples to see how Apryse easily fits into any workflow converting PDF files into other document files or images and back again. Need help in the meantime? Contact our support team for free technical support! For pricing or licensing questions, you can contact our sales team.
Tags
C#
automation
Vendor consolidation
Apryse
Share this post
PRODUCTS
Platform Integrations
End User Applications
Popular Content