ByteScout Data Extraction Suite - C# - Data Masking in PDF with PDF Extractor SDK - ByteScout

ByteScout Data Extraction Suite – C# – Data Masking in PDF with PDF Extractor SDK

  • Home
  • /
  • Articles
  • /
  • ByteScout Data Extraction Suite – C# – Data Masking in PDF with PDF Extractor SDK

data masking in PDF with PDF extractor SDK in C# using ByteScout Data Extraction Suite

How to apply ByteScout Data Extraction Suite for data masking in PDF with PDF extractor SDK in C#

These source code samples are assembled by their programming language and functions they use. ByteScout Data Extraction Suite was created to assist data masking in PDF with PDF extractor SDK in C#. ByteScout Data Extraction Suite is the bundle that includes three SDK tools for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK.

Save time on writing and testing code by using the code below and use it in your application. Just copy and paste this C# sample code to your C# application’s code editor, add a reference to ByteScout Data Extraction Suite (if you haven’t added yet) and you are ready to go! These C# sample examples can be used in one or many applications.

If you want to try other samples for C# then free trial version of ByteScout Data Extraction Suite is available on 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 Bytescout.PDFExtractor; using System; using System.Diagnostics; using System.IO; using System.Text.RegularExpressions; namespace RepairText { class Program { static void Main(string[] args) { try { // Generate CSVExtractor instance using (CSVExtractor extractor = new CSVExtractor("demo", "demo")) { // Load PDF document extractor.LoadDocumentFromFile("sample.pdf"); // Get all data string allData = extractor.GetCSV(); // Regular expressions and replacements string ssnRegex = @"\d{3}[-]?\d{2}[-]?\d{4}"; string ssnReplace = "***-**-****"; string phoneRegex = @"\d{3}[-]?\d{3}[-]?\d{4}"; string phoneReplace = "***-***-****"; // Find and mask SSN and phone numbers allData = Regex.Replace(allData, ssnRegex , ssnReplace); allData = Regex.Replace(allData, phoneRegex, phoneReplace); // Write as CSV File.WriteAllText("output.csv", allData); // Open file ProcessStartInfo processStartInfo = new ProcessStartInfo("output.csv"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); } } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine("Press enter key to close..."); Console.ReadLine(); } } }

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