---
title: "Redo redaction from the original PDF in C#"
url: https://recursiveai.org/onepdf/cookbook/redo-redaction-from-original-pdf/
description: "Reapply saved redaction regions to the original PDF with OnePDF 1.26.1, review the new copy, and replace the old redacted output."
version: "1.26.1"
---

# Redo redaction from the original PDF in C#

**OnePDF** is a free, open-source PDF library for .NET from Recursive AI. MIT or Apache-2.0, no native dependencies.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OnePdf) · [GitHub](https://github.com/recursive-ai-oss/onepdf-csharp) · [Docs](https://recursiveai.org/onepdf/docs/) · [Download example (.zip)](https://recursiveai.org/onepdf/cookbook/redo-redaction-from-original-pdf/redo-redaction-from-original-pdf.zip)

Redaction in OnePDF 1.6.0–1.25.2 could leave “text moved or missing”; 1.26.0 fixes this, and the [release notes](https://recursiveai.org/onepdf/docs/changelog/) advise you to “run redaction again on the original documents with 1.26.0 and replace the old output.” Page 2 of the zip’s `original.pdf` reads “Keep this line” above “Demo account 1234.”

```shell
dotnet add package RecursiveAI.OnePdf
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```csharp
using OnePdf;

var area = new PdfRectangle(70, 655, 240, 676);
// Page index 1 = second page.
PdfRedactionRegion[] savedRegions =
    [new(1, area)];
var edit = new PdfOpenOptions
{
    AllowEditing = true
};
using var doc =
    PdfDocument.Open("original.pdf", edit);
doc.Redact(savedRegions);
doc.Save("redacted-review.pdf");
Console.WriteLine("Wrote redacted-review.pdf");
```

[The example](https://recursiveai.org/onepdf/cookbook/redo-redaction-from-original-pdf/redo-redaction-from-original-pdf.zip) is the full program below: unzip it and `dotnet run`. To run only the code above, paste it into Program.cs of a new `dotnet new console` project and `dotnet run`.

```text
Wrote redacted-review.pdf
```

## The full program

```csharp
using OnePdf;

var area = new PdfRectangle(70, 655, 240, 676);
// Page index 1 = second page.
PdfRedactionRegion[] savedRegions =
    [new(1, area)];
var edit = new PdfOpenOptions
{
    AllowEditing = true
};
using var doc =
    PdfDocument.Open("original.pdf", edit);
doc.Redact(savedRegions);
doc.Save("redacted-review.pdf");
Console.WriteLine("Wrote redacted-review.pdf");

using var review =
    PdfDocument.Open("redacted-review.pdf");
var remaining = review.Pages[1].ExtractText();
Console.WriteLine(remaining.Text.Trim());
```

```text
Wrote redacted-review.pdf
Keep this line
```

`PdfRectangle(70, 655, 240, 676)` gives the left, bottom, right, and top edges in PDF points before page rotation. In this sample, `(0, 0)` is the lower-left corner, and y increases upward. The full program reopens the review copy and prints the remaining text. Review the affected pages. Once approved, move `redacted-review.pdf` into the publication location under the old redacted file’s name; never replace `original.pdf`. If OnePDF can’t fully read the page, `Redact` throws `PdfRedactionException` and the document stays unchanged.

## Variations

**Draw a black box after removal.** Replace the `Redact` call with:

```csharp
var overlay = new PdfRedactionOverlay();
doc.Redact(
    savedRegions, new() { Overlay = overlay });
```

## Related recipes

- [Redact text and images in a PDF](https://recursiveai.org/onepdf/cookbook/redact/)
- [Catch a PDF redaction failure](https://recursiveai.org/onepdf/cookbook/catch-pdf-redaction-exception/)

## The short answer

Use OnePDF 1.26.1 to open the original unredacted file, pass the saved regions to `Redact`, and write a separate review copy with a full `Save`. Check the replacement before you publish it. Running redaction on the previous output can’t restore text or drawing instructions that were lost or changed there.

## Can PDF redaction be reversed?

Not by rerunning redaction on the redacted copy. A real redaction removes underlying page content rather than simply covering it. To change or repeat a run, use the source document as it was when you reviewed the regions. Keep that source under restricted access, separate from the copies you send out.

## Why is text missing after I apply redactions to a PDF?

OnePDF versions 1.6.0 through 1.25.2 could produce a redacted copy with moved or missing text or paths in the wrong color. The 1.26.0 release fixes how the content rewrite separates PDF instructions and recommends rerunning the job on the original. The release notes say the issue did not affect removal of the redacted content itself. To review the repaired copy, check both sides of the job: the targeted content is gone and the surrounding text and graphics are still intact.

## How do I apply the same redaction areas again?

Use the same revision, page order, and coordinates as the first run. OnePDF takes zero-based page indexes and rectangles in the page’s default user space before rotation. If you saved rectangles from a preview with a top-left origin or rotated pages, make sure they’re converted to PDF coordinates. A moved paragraph or a newly inserted cover page can make a previously correct rectangle target the wrong content. Use full `Save`, not `SaveIncremental`: an incremental save would retain earlier bytes and OnePDF refuses it after redaction. If the original was signed, saving the redacted file invalidates those signatures.
