ByteScout Data Extraction Suite - C# - Batch check folder agianst JSON settings with PDF Extractor SDK - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Data Extraction Suite – C# – Batch check folder agianst JSON settings with PDF Extractor SDK

  • Home
  • /
  • Articles
  • /
  • ByteScout Data Extraction Suite – C# – Batch check folder agianst JSON settings with PDF Extractor SDK

batch check folder agianst JSON settings with PDF extractor SDK in C# using ByteScout Data Extraction Suite

Learn to code in C# to make batch check folder agianst JSON settings with PDF extractor SDK with this simple How-To tutorial

This page helps you to learn from code samples for programming in C#. ByteScout Data Extraction Suite was created to assist batch check folder agianst JSON settings with PDF extractor SDK in C#. ByteScout Data Extraction Suite is the set that includes 3 SDK products for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK.

If you want to quickly learn then these fast application programming interfaces of ByteScout Data Extraction Suite for C# plus the guideline and the C# code below will help you quickly learn batch check folder agianst JSON settings with PDF extractor SDK. If you want to know how it works, then this C# sample code should be copied and pasted into your application’s code editor. Then just compile and run it. Further improvement of the code will make it more robust.

Trial version along with the source code samples for C# can be downloaded from our website

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using BatchCheckFolderAgainstJsonSettings; using Bytescout.PDFExtractor; using Newtonsoft.Json; using System; using System.IO; namespace FindUsAddressRegex { class Program { static void Main(string[] args) { try { // Get all settings VM var allSettings = GetSettingsVM("settings.json"); // Create Bytescout.PDFExtractor.TextExtractor instance TextExtractor extractor = new TextExtractor(); extractor.RegistrationName = "demo"; extractor.RegistrationKey = "demo"; foreach (var fileName in Directory.GetFiles("InputFiles")) { // Load sample PDF document extractor.LoadDocumentFromFile(fileName); // Enable regex search extractor.RegexSearch = true; // Get Number of pages PDF contains int pageCount = extractor.GetPageCount(); for (int iPage = 0; iPage < pageCount; iPage++) { // Loop through all search settings foreach (var itmSearchSetting in allSettings.Settings) { // If found, then copy file to sub-category folder if(extractor.Find(iPage, itmSearchSetting.regex, false)) { // If Directory does not exists, then create them if (!Directory.Exists({code}quot;{allSettings.MainFolderName}/{itmSearchSetting.category}")) { Directory.CreateDirectory({code}quot;{allSettings.MainFolderName}/{itmSearchSetting.category}"); } // Copy File File.Copy(fileName, {code}quot;{allSettings.MainFolderName}/{itmSearchSetting.category}/{Path.GetFileName(fileName)}", true); } } } } // Cleanup extractor.Dispose(); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } Console.WriteLine(); Console.WriteLine("Press enter key to continue..."); Console.ReadLine(); } /// <summary> /// Get Settings VM /// </summary> private static SettingsVM GetSettingsVM(string settingsFileName) { var allJson = File.ReadAllText(settingsFileName); return JsonConvert.DeserializeObject<SettingsVM>(allJson); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

SettingsVM.cs
      
using System; using System.Collections.Generic; using System.Text; namespace BatchCheckFolderAgainstJsonSettings { public class SettingsVM { public string MainFolderName { get; set; } public List<Settings> Settings { get; set; } } public class Settings { public string category { get; set; } public string regex { get; set; } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

packages.config
      
<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Newtonsoft.Json" version="12.0.2" targetFramework="net20" /> </packages>

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next