ByteScout Sensitive Data Suite - C# - Check For Sensitive Data and PII in PDF - ByteScout

ByteScout Sensitive Data Suite – C# – Check For Sensitive Data and PII in PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout Sensitive Data Suite – C# – Check For Sensitive Data and PII in PDF

check for sensitive data and PII in PDF in C# using ByteScout Sensitive Data Suite

Learn check for sensitive data and PII in PDF in C#

An easy to understand guide to learn how to check for sensitive data and PII in PDF in C#. ByteScout Sensitive Data Suite was made to help with check for sensitive data and PII in PDF in C#. ByteScout Sensitive Data Suite is the bundle that includes multiple components from ByteScout for working with sensitive and personal data. With these components you may analyze, redact, remove, blackout sensitive data in documents and pdf.

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 Sensitive Data Suite (if you haven’t added yet) and you are ready to go! Want to see how it works with your data then code testing will allow the function to be tested and work properly.

Visit our website to get a free trial version of ByteScout Sensitive Data Suite. Free trial contains many of source code samples to help you with your C# project.

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 System; using System.Drawing; using Bytescout.PDFExtractor; namespace CheckForSensitiveAndPIIDataFromPDF { class Program { static void Main(string[] args) { // Create Bytescout.PDFExtractor.Remover2 instance Remover2 remover = new Remover2("demo", "demo"); // Mask removed text, which ultimately black out region remover.MaskRemovedText = true; // Load sample PDF document remover.LoadDocumentFromFile(@"samplePDF_EmailSSN.pdf"); // Prepare TextExtractor using (TextExtractor textExtractor = new TextExtractor("demo", "demo")) { // Load document into TextExtractor textExtractor.LoadDocumentFromFile(@"samplePDF_EmailSSN.pdf"); // Enable RegexSearch textExtractor.RegexSearch = true; // Set word matching options textExtractor.WordMatchingMode = WordMatchingMode.None; // Search SSN in format 202-55-0130 string regexPatternSSN = "[0-9]{3}-[0-9]{2}-[0-9]{4}"; // Search email Addresses string regexPatternEmail = @"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"; // Search results for SSN ISearchResult[] searchResultsSSN = textExtractor.FindAll(0, regexPatternSSN, caseSensitive: false); // Search results for Email ISearchResult[] searchResultEmail = textExtractor.FindAll(0, regexPatternEmail, caseSensitive: false); // Remove SSN result text objects find by SearchResults. remover.AddTextToRemove(searchResultsSSN); // Remove Email result text objects find by SearchResults. remover.AddTextToRemove(searchResultEmail); // Perform removal of specified objects remover.PerformRemoval(@"result1.pdf"); } // Open output file in default application System.Diagnostics.Process.Start("result1.pdf"); // Clean up. remover.Dispose(); } } }

ON-PREMISE OFFLINE SDK

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

Explore ByteScout Sensitive Data Suite Documentation

Explore Samples

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

Explore ByteScout Sensitive Data Suite Documentation

Explore Samples

Sign Up for ByteScout Sensitive Data Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

prev
next