What You Can Do with GroupDocs.Redaction for .NET

Remove Sensitive Text from PDF Documents Using .NET

Use C# and GroupDocs.Redaction for .NET to take full control over content in your PDF files. Redact personal, legal, or confidential data with ease.

How to Redact Content in Pdf Files

Protect your documents in any .NET app using GroupDocs.Redaction for .NET. Redact sensitive text quickly and accurately.

  1. Initialize a Redactor and load your Pdf file.
  2. Set up the redaction options you need.
  3. Specify the text to search and the replacement text.
  4. Run the redaction and save the file.
// How to redact text in a PDF file

// Load your file using the Redactor constructor
using (Redactor redactor  = new Redactor("input.pdf"))
{
    // Set your redaction preferences
    // Choose what to search and what to replace it with
    var repl_opt = new ReplacementOptions("[redacted]");
    
    var redaction = new ExactPhraseRedaction("Text to hide", repl_opt);

    // Apply redactions and save the new PDF file
    redactor.Apply(redaction);
    redactor.Save();
}
dotnet add package GroupDocs.Redaction
click to copy
copied
More examples Documentation

More Ways to Redact Documents

GroupDocs.Redaction for .NET helps remove or hide sensitive content in multiple file formats. Keep documents clean and safe to share.

Redaction tools and options

Replace confidential text

Find and replace matching text anywhere in your file. Supports regex and smart search options.

Hide sensitive images

Cover images or specific areas with overlays. Adjust page settings, colors, and more.

Clean hidden metadata

Remove hidden data like authorship, timestamps, or comments to protect privacy.

Redact Text with Regex

Use regular expressions to search and redact sensitive text patterns like emails or IDs.

C#

//  Open the document you want to clean
using (Redactor redactor  = new Redactor("source.pdf"))
{
    // Define an EMAIL regex pattern and the text to use as replacement
    var repl_opt = new ReplacementOptions("[redacted]");
    string emailRegex = @"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}";

    var redaction = new RegexRedaction(emailRegex, repl_opt);

    // Apply redaction rules
    redactor.Apply(redaction);

    // Save the final redacted file
    var save_opt = new SaveOptions() { AddSuffix = true, RasterizeToPDF = false };
    var outputPath = redactor.Save(save_opt);
}
dotnet add package GroupDocs.Redaction
click to copy
copied
More examples Documentation

What is GroupDocs.Redaction for .NET?

GroupDocs.Redaction for .NET gives C# developers everything they need to redact PDF content. Clean up text, images, annotations, comments, and metadata in popular file types.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Redaction for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Redact Content in PDF Using .NET

Protect official and personal data by redacting text in PDF files with .NET tools. Keep documents secure and private.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English