ByteScout Sensitive Data Suite - C# - Remove PII Data From PDF - ByteScout

ByteScout Sensitive Data Suite – C# – Remove PII Data From PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout Sensitive Data Suite – C# – Remove PII Data From PDF

How to remove PII data from PDF in C# and ByteScout Sensitive Data Suite

This code in C# shows how to remove PII data from PDF with this how to tutorial

Sample source code below will display you how to manage a complex task like remove PII data from 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. It can be applied to remove PII data from PDF using C#.

The SDK samples given below describe how to quickly make your application do remove PII data from PDF in C# with the help of ByteScout Sensitive Data Suite. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! If you want to use these C# sample examples in one or many applications then they can be used easily.

ByteScout Sensitive Data Suite free trial version is available on our website. C# and other programming languages are supported.

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 RemovePIIDataFromPDF { class Program { static void Main(string[] args) { // Create Bytescout.PDFExtractor.Remover instance Remover remover = new Remover("demo", "demo"); // Load sample PDF document remover.LoadDocumentFromFile(@"samplePDF_SSNNo.pdf"); // Prepare TextExtractor using (TextExtractor textExtractor = new TextExtractor("demo", "demo")) { // Load document into TextExtractor textExtractor.LoadDocumentFromFile(@"samplePDF_SSNNo.pdf"); // Search SSN in format 202-55-0130 // See the complete regular expressions reference at https://msdn.microsoft.com/en-us/library/az24scfc(v=vs.110).aspx string regexPattern = "[0-9]{3}-[0-9]{2}-[0-9]{4}"; // Enable RegexSearch textExtractor.RegexSearch = true; // Set word matching options textExtractor.WordMatchingMode = WordMatchingMode.None; ISearchResult[] searchResults = textExtractor.FindAll(0, regexPattern, caseSensitive: false); // Remove text objects find by SearchResults. // NOTE: The removed text might be larger than the specified rectangle. Currently the Remover is unable // to split PDF text objects. remover.RemoveText(searchResults, @"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