Back to Devexpress

PdfRedactAnnotationFacade.Apply(PdfClearContentOptions) Method

officefileapi-devexpress-dot-pdf-dot-pdfredactannotationfacade-dot-apply-x28-devexpress-dot-pdf-dot-pdfclearcontentoptions-x29.md

latest3.9 KB
Original Source

PdfRedactAnnotationFacade.Apply(PdfClearContentOptions) Method

Applies the redaction annotation. Allows you to specify what content type to keep visible in the redaction area.

Namespace : DevExpress.Pdf

Assembly : DevExpress.Pdf.v25.2.Core.dll

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public void Apply(
    PdfClearContentOptions options = null
)
vb
Public Sub Apply(
    options As PdfClearContentOptions = Nothing
)

Optional Parameters

NameTypeDefaultDescription
optionsPdfClearContentOptionsnull

Options that specify what content type to keep visible in the redaction area.

|

Example

The following code snippet applies redaction annotations made by a specific author:

csharp
using DevExpress.Pdf;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{

    processor.LoadDocument("output_to_review.pdf");
    PdfDocumentFacade documentFacade = processor.DocumentFacade;

    foreach (var page in documentFacade.Pages)
    {
        var redactionAnnotations = page.Annotations.Where(annotation => annotation.Type == PdfAnnotationType.Redaction).ToList();
        foreach (PdfRedactAnnotationFacade annotation in redactionAnnotations)
        {
            if (annotation.Author == "Jane Doe")
                annotation.Apply();
        }
    }
    processor.SaveDocument("output_applied.pdf");
}
vb
Using processor As New PdfDocumentProcessor()
  Dim documentFacade As PdfDocumentFacade = processor.DocumentFacade
  For Each page In documentFacade.Pages
    Dim redactionAnnotations = page.Annotations.Where(Function(annotation) TypeOf annotation Is PdfRedactAnnotationFacade)
    For Each annotation As PdfRedactAnnotationFacade In redactionAnnotations
      ' Apply redaction from a specific author
      If annotation.Author = "Jane Doe" Then
        annotation.Apply()
      End If
    Next annotation
  Next page
End Using

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Apply(PdfClearContentOptions) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-pdf-viewer-redaction-annotations/CS/DXApplication1/Form1.cs#L59

csharp
redactAnnotation.Apply();
}

winforms-pdf-viewer-redaction-annotations/VB/DXApplication1/Form1.vb#L44

vb
redactAnnotation.Apply()
Next rect

See Also

PdfRedactAnnotationFacade Class

PdfRedactAnnotationFacade Members

DevExpress.Pdf Namespace