Skip to content

# PDFContentRedactor

Namespace: O2S.Components.PDF4NET.Redaction

Defines a redactor for PDF page content.

    public class PDFContentRedactor

Inheritance Object → PDFContentRedactor

## Constructors

### PDFContentRedactor(PDFPage)

Initializes a new PDFContentRedactor object.

    public PDFContentRedactor(PDFPage page)

Parameters

`page` PDFPage
The page from which content is redacted.

## Methods

### ApplyRedaction()

Applies the redaction on the PDF page.

    public void ApplyRedaction()

Exceptions

PDFInvalidStateException
Thrown when the page has been closed before the redaction has been applied.

Remarks

The PDFContentRedactor.BeginRedaction() / PDFContentRedactor.ApplyRedaction() pair of methods lets you redact multiple areas on a PDF page in a single step. The page content is redacted when this method is called if redaction has been initialized with the PDFContentRedactor.BeginRedaction() method and redaction areas have been setup by one or more calls to PDFContentRedactor.RedactArea(PDFDisplayRectangle) method.

### BeginRedaction()

Initializes the redaction process.

    public void BeginRedaction()

Remarks

The PDFContentRedactor.BeginRedaction() / PDFContentRedactor.ApplyRedaction() pair of methods lets you redact multiple areas on a PDF page in a single step. When this method has been called, the PDFContentRedactor.RedactArea(PDFDisplayRectangle) method has no immediate effect, the actual redaction takes place when PDFContentRedactor.ApplyRedaction() method is called. If this method is called but the PDFContentRedactor.ApplyRedaction() method is not called, the redaction process does not take place.

### RedactAnnotation(PDFRedactionAnnotation)

Redacts the area specified by the redaction annotation.

    public void RedactAnnotation(PDFRedactionAnnotation redactionAnnotation)

Parameters

`redactionAnnotation` PDFRedactionAnnotation
The redaction annotation that specifies the area to redact.

Exceptions

PDFInvalidStateException
Thrown when the page has been closed before the redaction has been applied.

### RedactAnnotations()

Redacts the areas specified by the redaction annotations on the current page.

    public void RedactAnnotations()

Exceptions

PDFInvalidStateException
Thrown when the page has been closed before the redaction has been applied.

### RedactArea(PDFDisplayRectangle)

Redacts the page content from the specified area.

    public void RedactArea(PDFDisplayRectangle redactionArea)

Parameters

`redactionArea` PDFDisplayRectangle
Area from which the content should be redacted.

Exceptions

PDFInvalidStateException
Thrown when the page has been closed before the redaction has been applied.

Remarks

If PDFContentRedactor.BeginRedaction() method has not been called before then the content is redacted immediately. Otherwise the redaction area is stored and the redaction takes place when PDFContentRedactor.ApplyRedaction() method has been called.

### RedactArea(PDFDisplayRectangle, PDFColor)

Redacts the page content from the specified area.

    public void RedactArea(PDFDisplayRectangle redactionArea, PDFColor redactionColor)

Parameters

`redactionArea` PDFDisplayRectangle
Area from which the content should be redacted.

`redactionColor` PDFColor
Color used for masking the redacted area.

Exceptions

PDFInvalidStateException
Thrown when the page has been closed before the redaction has been applied.

Remarks

If PDFContentRedactor.BeginRedaction() method has not been called before then the content is redacted immediately. Otherwise the redaction area is stored and the redaction takes place when PDFContentRedactor.ApplyRedaction() method has been called.

### RedactArea(PDFDisplayRectangle, PDFColor, PDFContentRedactType)

Redacts the page content from the specified area.

    public void RedactArea(PDFDisplayRectangle redactionArea, PDFColor redactionColor, PDFContentRedactType contentRedactType)

Parameters

`redactionArea` PDFDisplayRectangle
Area from which the content should be redacted.

`redactionColor` PDFColor
Color used for masking the redacted area.

`contentRedactType` PDFContentRedactType
Specifies the type of content to be redacted.

Exceptions

PDFInvalidStateException
Thrown when the page has been closed before the redaction has been applied.

Remarks

If PDFContentRedactor.BeginRedaction() method has not been called before then the content is redacted immediately. Otherwise the redaction area is stored and the redaction takes place when PDFContentRedactor.ApplyRedaction() method has been called.

### RedactArea(PDFDisplayRectangle, PDFContentRedactionOptions)

Redacts the page content from the specified area.

    public void RedactArea(PDFDisplayRectangle redactionArea, PDFContentRedactionOptions redactionOptions)

Parameters

`redactionArea` PDFDisplayRectangle
Area from which the content should be redacted.

`redactionOptions` PDFContentRedactionOptions
Options for content redaction.

Exceptions

PDFInvalidStateException
Thrown when the page has been closed before the redaction has been applied.

Remarks

If PDFContentRedactor.BeginRedaction() method has not been called before then the content is redacted immediately. Otherwise the redaction area is stored and the redaction takes place when PDFContentRedactor.ApplyRedaction() method has been called.