ByteScout Premium 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 Premium Suite – C# – Batch check folder agianst JSON settings with PDF Extractor SDK

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

batch check folder agianst JSON settings with PDF extractor SDK in C# and ByteScout Premium Suite

Learn batch check folder agianst JSON settings with PDF extractor SDK in C#

Writing of the code to batch check folder agianst JSON settings with PDF extractor SDK in C# can be done by developers of any level using ByteScout Premium Suite. Batch check folder agianst JSON settings with PDF extractor SDK in C# can be applied with ByteScout Premium Suite. ByteScout Premium Suite is the bundle that includes twelve SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording.

C# code snippet like this for ByteScout Premium Suite works best when you need to quickly implement batch check folder agianst JSON settings with PDF extractor SDK in your C# application. 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. Use of ByteScout Premium Suite in C# is also described in the documentation included along with the product.

ByteScout Premium Suite free trial version is available for download from our website. Free trial also includes programming tutorials along with source code samples.

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 Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium 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 Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium 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 Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium 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 Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next