---
title: "Smart redaction C# .NET: Secure and permanent | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/redaction/smart-redaction/"
md_url: "https://www.nutrient.io/guides/dotnet/redaction/smart-redaction.md"
last_updated: "2026-05-21T17:12:02.215Z"
description: "Learn how to implement smart redaction in C# using Nutrient .NET SDK. Automatically detect and redact sensitive information from documents programmatically."
---

# Smart redaction in C#

Based on its advanced artificial intelligence (AI) and document understanding engine, Nutrient.NET SDK (formerly GdPicture.NET) recognizes sensitive information in a document and marks it for redaction. After you validate these marks, Nutrient.NET SDK removes them from the document.

To redact sensitive information, follow these steps:

1. Create a `GdPicturePDF` object.

2. Select the source PDF file by passing its path to the `LoadFromFile` method of the `GdPicturePDF` object.

3. Configure the redaction process by creating a `GdPicturePDF.SmartRedactionOptions` object in the following way:
   - Set the path to the OCR resource folder with the `ResourcePath` property. The default language resources are located in `GdPicture.NET 14\Redist\OCR`. For more information on adding language resources, see the [language support](https://www.nutrient.io/guides/dotnet/ocr/language-support.md) guide.
   - By default, detected sensitive information is immediately removed. To only mark sensitive information for redaction without actually removing it, set the `Immediate` property to `false`.
   - Set the types of sensitive information that you want to redact by setting the following properties to `true`: `RedactCreditCardNumbers`, `RedactEmailAddresses`, `RedactIBANs`, `RedactPhoneNumbers`, `RedactSocialSecurityNumbers`, `RedactURIs`, `RedactVatIDs`, `RedactVehicleIdentificationNumbers`, `RedactPostalAddresses`.

4. Run the redaction process by passing the `GdPicturePDF.SmartRedactionOptions` object to the `SmartRedaction` method of the `GdPicturePDF` object.

5. Save the output in a PDF document with the `SaveToFile` method.

The example below loads a PDF document, removes sensitive information such as credit card numbers and email addresses, and then saves the redacted file in a PDF:

### C#

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
// Load the source document.
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Configure the redaction process.
GdPicturePDF.SmartRedactionOptions redactionOptions = new GdPicturePDF.SmartRedactionOptions()
    {
        ResourcePath = @"C:\GdPicture.NET 14\Redist\OCR",
        RedactCreditCardNumbers = true,
        RedactEmailAddresses = true,
        RedactIBANs = true,
        RedactPhoneNumbers = true,
        RedactSocialSecurityNumbers = true,
        RedactURIs = true,
        RedactVatIDs = true,
        RedactVehicleIdentificationNumbers = true,
        RedactPostalAddresses = true
    };
// Run the redaction process.
gdpicturePDF.SmartRedaction(redactionOptions);
// Save the output in a PDF document.
gdpicturePDF.SaveToFile(@"C:\temp\output.pdf");

```

### VB.NET

```vb

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    ' Load the source document.
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Configure the redaction process.
    Dim redactionOptions As GdPicturePDF.SmartRedactionOptions = New GdPicturePDF.SmartRedactionOptions() With {.ResourcePath = "C:\GdPicture.NET 14\Redist\OCR",.RedactCreditCardNumbers = True,.RedactEmailAddresses = True,.RedactIBANs = True,.RedactPhoneNumbers = True,.RedactSocialSecurityNumbers = True,.RedactURIs = True,.RedactVatIDs = True,.RedactVehicleIdentificationNumbers = True.RedactPostalAddresses = True
        }
    // Run the redaction process.
    gdpicturePDF.SmartRedaction(redactionOptions)
    // Save the output in a PDF document.
    gdpicturePDF.SaveToFile("C:\temp\output.pdf")
End Using

```

#### Used methods and properties

- [`GdPicturePDF.SmartRedactionOptions`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF+SmartRedactionOptions.html)

- [`LoadFromFile`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~LoadFromFile.html)

- [`SaveToFile`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~SaveToFile.html)

- [`SmartRedaction`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~SmartRedaction.html)

#### Related topics

- [Load a file](/guides/dotnet/load-a-file.md)

- [Save a file](/guides/dotnet/save-a-file.md)
---

## Related pages

- [Redact PDFs in C#.NET](/guides/dotnet/redaction.md)
- [Search and redact PDFs in C#](/guides/dotnet/redaction/search-and-redact.md)
- [Redact PDFs using coordinates in C#](/guides/dotnet/redaction/redact-by-coordinates.md)

