An easy to understand guide to learn how to batch check folder agianst JSON settings with PDF extractor SDK in C#. ByteScout PDF Suite helps with batch check folder agianst JSON settings with PDF extractor SDK in C#. ByteScout PDF Suite is the set that includes 6 SDK products to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript.
Save time on writing and testing code by using the code below and use it in your application. Follow the steps-by-step instructions from the scratch to work and copy and paste code for C# into your editor. This basic programming language sample code for C# will do the whole work for you in implementing batch check folder agianst JSON settings with PDF extractor SDK in your app.
Trial version can be downloaded from our website for free. It contains this and other source code samples for C#.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
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); } } }
60 Day Free Trial or Visit ByteScout PDF Suite Home Page
Explore ByteScout PDF Suite Documentation
Explore Samples
Sign Up for ByteScout PDF Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
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; } } }
60 Day Free Trial or Visit ByteScout PDF Suite Home Page
Explore ByteScout PDF Suite Documentation
Explore Samples
Sign Up for ByteScout PDF Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Newtonsoft.Json" version="12.0.2" targetFramework="net20" /> </packages>
60 Day Free Trial or Visit ByteScout PDF Suite Home Page
Explore ByteScout PDF Suite Documentation
Explore Samples
Sign Up for ByteScout PDF Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout PDF Suite Home Page
Explore ByteScout PDF Suite Documentation
Explore Samples
Sign Up for ByteScout PDF Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: