---
title: "Add redaction annotations in C# | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/csharp/editor/add-redaction-annotations-to-pdf/"
md_url: "https://www.nutrient.io/guides/dotnet/csharp/editor/add-redaction-annotations-to-pdf.md"
last_updated: "2026-10-08T00:00:00.000Z"
description: "How to add redaction annotations to permanently remove sensitive content from PDFs using Nutrient .NET SDK."
---

# Adding redaction annotations to a PDF document

Redaction annotations permanently remove sensitive content to ensure compliance with privacy regulations. This process involves two stages: marking areas for removal, and applying the redactions to delete the underlying data.

[Download sample](https://www.nutrient.io/downloads/samples/csharp/add-redaction-annotations-to-pdf.zip)

### Redaction workflow

1. **Marking** — Create redaction annotations to define areas for removal. These act as placeholders you can review.

2. **Application** — Apply the annotations to permanently delete text and images. Once you apply a redaction, the content is unrecoverable.

### Use cases

- **Legal and government** — Remove case-sensitive or classified information before public release.

- **Healthcare and finance** — Redact PII, Social Security numbers, and account details to meet Health Insurance Portability and Accountability Act (HIPAA) or General Data Protection Regulation (GDPR) requirements.

- **Human resources** — Mask confidential data, such as salaries, within employment contracts.

### Capabilities

- Define rectangular areas for content removal.

- Customize the appearance using overlay colors or patterns.

- Enable manual or automatic redaction during save operations.

- Ensure data is unrecoverable after application.

## How Nutrient helps you achieve this

Nutrient.NET SDK manages the underlying complexities of PDF redaction, including:

- **Annotation architecture** — Handles appearance streams, coordinate transformations, and PDF structures.

- **Content removal logic** — Deletes underlying data while maintaining document integrity.

- **Visual customization** — Manages color space conversions and overlay patterns.

- **Save automation** — Controls whether to apply redactions or preserve markers during save operations.

The SDK’s API abstracts these tasks, enabling you to focus on your application’s business logic.

## Complete implementation

The example below demonstrates how to add and customize redaction annotations using Nutrient.NET SDK.

### Imports

Import the namespace required for document handling, editing, and customization:

```csharp

using Nutrient;

```

### Setting up and page access

Open the PDF using [using statements](https://learn.microsoft.com/dotnet/csharp/language-reference/statements/using) to ensure proper resource cleanup. If the document is empty, add a standard US Letter page (612 × 792 points):

```csharp

try
{
    using Document document = Document.Open("input.pdf");
    using PdfEditor editor = PdfEditor.Edit(document);
    PdfPageCollection pages = editor.PageCollection;

    if (pages.Count == 0)
    {
        pages.Add(612.0f, 792.0f);
    }

    PdfPage page = pages.First?? throw new InvalidOperationException("The document has no pages.");
    PdfAnnotationCollection annotations = page.AnnotationCollection;

```

### Adding a redaction annotation

Define the area for content removal. The coordinate system uses points (1 inch = 72 points), starting from the bottom-left corner. This example marks the header area:

```csharp

    PdfRedactAnnotation redaction = annotations.AddRedact(
        72.0f, 684.0f, 504.0f, 72.0f // x, y, width, height (1 inch from left, 9.5 inches from bottom, 7 inches wide, 1 inch tall)
    );

```

### Customizing the redaction appearance

Set the interior color to determine the fill color applied to the area after the content is deleted:

```csharp

    redaction.InteriorColor = Color.FromArgb(255, 0, 0, 0);

```

### Configuring save preferences

This example demonstrates preserve-markers behavior by setting the save preferences to `PdfSavePreferences.None`.
By default, the save preferences preserve redaction markers (`PdfSavePreferences.None`).

```csharp

    document.Settings.PdfSettings.SavePreferences = PdfSavePreferences.None;

```

**Important (save behavior)**

The default save preferences value preserves redaction markers (equivalent to `PdfSavePreferences.None`).
If you want to permanently apply redactions during save, set `SavePreferences` to `PdfSavePreferences.ApplyRedactions` instead.

Use `PdfSavePreferences.None` when you want to keep redaction annotations for review instead of applying them.

### Saving the document

Save the changes to a new file:

```csharp

    editor.SaveAs("output.pdf");
    Console.WriteLine("Successfully saved output.pdf");
}
catch (NutrientException e)
{
    Console.Error.WriteLine($"Error: {e.Message}");
    Environment.Exit(1);
}

```

## Conclusion

The redaction workflow involves these core steps:

1. **Initialize** — Open the PDF with `using` statements and create an editor instance using `PdfEditor.Edit()`.

2. **Access pages** — Retrieve the page collection. If the document is empty, add a page using standard dimensions (612 × 792 points).

3. **Target the area** — Get the annotation collection for the first page. Add a redaction marker by specifying the coordinates and dimensions in points.

4. **Style** — Set the interior color using ARGB values to define the fill color used after the content is removed.

5. **Configure save behavior** — Use the `SavePreferences` property to choose between automatic application or preserving markers for review.

6. **Finalize** — Save the document — the `using` statements release the native handles. Handle any `NutrientException` to manage processing errors.

Nutrient SDK automates PDF structures, coordinate transformations, and permanent data deletion. This ensures your application remains compliant with regulations such as GDPR or HIPAA without requiring manual implementation of complex redaction algorithms.
---

## Related pages

- [Nutrient .NET SDK editor guides](/guides/dotnet/csharp/editor.md)
- [Adding annotations to a PDF document](/guides/dotnet/csharp/editor/add-annotations-to-pdf.md)
- [Adding a custom page to a PDF document](/guides/dotnet/csharp/editor/add-custom-page-to-pdf.md)
- [Adding interactive form fields to a PDF document](/guides/dotnet/csharp/editor/add-form-fields-to-pdf.md)
- [Adding free text annotations to a PDF document](/guides/dotnet/csharp/editor/add-freetext-annotations-to-pdf.md)
- [Adding invisible digital signatures to a PDF document](/guides/dotnet/csharp/editor/add-invisible-signature-to-pdf.md)
- [Adding link annotations to a PDF document](/guides/dotnet/csharp/editor/add-link-annotations-to-pdf.md)
- [Adding shape annotations to a PDF document](/guides/dotnet/csharp/editor/add-shape-annotations-to-pdf.md)
- [Adding stamp annotations to a PDF document](/guides/dotnet/csharp/editor/add-stamp-annotations-to-pdf.md)
- [Adding sticky note annotations to a PDF document](/guides/dotnet/csharp/editor/add-sticky-note-annotations-to-pdf.md)
- [Adding text markup annotations to a PDF document](/guides/dotnet/csharp/editor/add-text-markup-annotations-to-pdf.md)
- [Adding visible digital signatures to a PDF document](/guides/dotnet/csharp/editor/add-visible-signature-to-pdf.md)
- [Advanced digital signature workflows](/guides/dotnet/csharp/editor/advanced-digital-signatures.md)
- [Detecting and adding form fields to a PDF document](/guides/dotnet/csharp/editor/detect-and-add-form-fields.md)
- [Editing PDF form fields](/guides/dotnet/csharp/editor/editing-pdf-form-fields.md)
- [Editing PDF metadata with Nutrient .NET SDK](/guides/dotnet/csharp/editor/editing-pdf-metadata.md)
- [Filling PDF form fields](/guides/dotnet/csharp/editor/fill-pdf-form.md)
- [Managing PDF page order](/guides/dotnet/csharp/editor/manage-pdf-page-order.md)
- [Merging PDFs](/guides/dotnet/csharp/editor/merge-pdf-into-other-pdf.md)

