Skip to main content
All docs
V26.1
  • PdfDocument.ApplyRedaction(Int32, RedactionAnnotation[]) Method

    Applies redaction annotations to a specified page.

    Namespace: DevExpress.Docs.Pdf

    Assembly: DevExpress.Docs.Pdf.v26.1.dll

    Declaration

    public void ApplyRedaction(
        int pageIndex,
        params RedactionAnnotation[] annotations
    )

    Parameters

    Name Type Description
    pageIndex Int32

    The index of the page where redaction annotations are applied.

    annotations RedactionAnnotation[]

    An array of redaction annotations to apply.

    Example

    How to: Apply Redaction Annotations

    The following code snippet applies all redaction annotations on the first page:

    using DevExpress.Docs.Pdf;
    using System.IO;
    using System.Linq;
    
    using (PdfDocument pdfDocument =
        new PdfDocument(File.OpenRead(
            @"C:\Documents\document_001.pdf")))
    {
        var page = pdfDocument.Pages[0];
        // Get all redaction annotations on the page.
        RedactionAnnotation[] redactions = page.Annotations
            .OfType<RedactionAnnotation>()
            .ToArray();
    
        // Apply redaction annotations.
        pdfDocument.ApplyRedaction(
            0, redactions);
    
        using (FileStream stream =
            File.Create("UpdatedDocument.pdf"))
        {
            pdfDocument.Save(stream);
        }
    }
    
    See Also