officefileapi-devexpress-dot-pdf-dot-pdfpagefacade-dot-addredactannotation-x28-devexpress-dot-pdf-dot-pdfrectangle-x29.md
Creates a redaction annotation in the specified page area.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public PdfRedactAnnotationFacade AddRedactAnnotation(
PdfRectangle rectangle
)
Public Function AddRedactAnnotation(
rectangle As PdfRectangle
) As PdfRedactAnnotationFacade
| Name | Type | Description |
|---|---|---|
| rectangle | PdfRectangle |
A rectangle where the redaction annotation should be located.
|
| Type | Description |
|---|---|
| PdfRedactAnnotationFacade |
An object that contains redaction annotation properties.
|
using DevExpress.Pdf;
PdfDocumentProcessor pdfProcessor = new PdfDocumentProcessor();
pdfProcessor.LoadDocument("Demo.pdf");
PdfDocumentFacade documentFacade = pdfProcessor.DocumentFacade;
PdfRectangle pageCropBox = pdfProcessor.Document.Pages[0].CropBox;
PdfRectangle redactBounds = new PdfRectangle(0, pageCropBox.Height - 50, 200, pageCropBox.Height);
// Add a redaction annotation at the top left corner of the first document page
PdfRedactAnnotationFacade redactAnnotation = documentFacade.Pages[0].AddRedactAnnotation(redactBounds);
redactAnnotation.Author = "Jane Doe";
// Setup the redaction annotation appearance
redactAnnotation.FillColor = new PdfRGBColor(0, 0, 0);
redactAnnotation.FontColor = new PdfRGBColor(1, 1, 1);
redactAnnotation.FontName = "Calibri";
redactAnnotation.FontSize = 0; // enables font auto-size
redactAnnotation.OverlayText = "Classified";
redactAnnotation.TextJustification = PdfTextJustification.Centered;
redactAnnotation.RepeatText = false;
// Save the document with the redaction annotation and send it for review
pdfProcessor.SaveDocument("output_to_review.pdf");
Imports DevExpress.Pdf
Private pdfProcessor As New PdfDocumentProcessor()
pdfProcessor.LoadDocument("Demo.pdf")
Dim documentFacade As PdfDocumentFacade = pdfProcessor.DocumentFacade
Dim pageCropBox As PdfRectangle = pdfProcessor.Document.Pages(0).CropBox
Dim redactBounds As New PdfRectangle(0, pageCropBox.Height - 50, 200, pageCropBox.Height)
' Add a redaction annotation at the top left corner of the first document page
Dim redactAnnotation As PdfRedactAnnotationFacade = documentFacade.Pages(0).AddRedactAnnotation(redactBounds)
redactAnnotation.Author = "Jane Doe"
' Setup the redaction annotation appearance
redactAnnotation.FillColor = New PdfRGBColor(0, 0, 0)
redactAnnotation.FontColor = New PdfRGBColor(1, 1, 1)
redactAnnotation.FontName = "Calibri"
redactAnnotation.FontSize = 0 ' enables font auto-size
redactAnnotation.OverlayText = "Classified"
redactAnnotation.TextJustification = PdfTextJustification.Centered
redactAnnotation.RepeatText = False
' Save the document with the redaction annotation and send it for review
pdfProcessor.SaveDocument("output_to_review.pdf")
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AddRedactAnnotation(PdfRectangle) 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#L49
PdfRedactAnnotationFacade redactAnnotation = documentFacade.Pages[rect.PageIndex].AddRedactAnnotation(bounds);
redactAnnotation.Author = "Jane Doe";
winforms-pdf-viewer-redaction-annotations/VB/DXApplication1/Form1.vb#L34
Dim redactAnnotation As PdfRedactAnnotationFacade = documentFacade.Pages(rect.PageIndex).AddRedactAnnotation(bounds)
redactAnnotation.Author = "Jane Doe"
See Also