officefileapi-devexpress-dot-pdf-dot-pdfpagefacade-dot-addredactannotation-x28-devexpress-dot-pdf-dot-pdforientedrectangle-system-dot-boolean-x29.md
Creates a redaction annotation in the specified rectangle. Allows you to specify whether to use the page coordinate system.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public PdfRedactAnnotationFacade AddRedactAnnotation(
PdfOrientedRectangle rectangle,
bool usePageCoordinateSystem = true
)
Public Function AddRedactAnnotation(
rectangle As PdfOrientedRectangle,
usePageCoordinateSystem As Boolean = True
) As PdfRedactAnnotationFacade
| Name | Type | Description |
|---|---|---|
| rectangle | PdfOrientedRectangle |
A page rectangle where the redaction annotation should be located.
|
| Name | Type | Default | Description |
|---|---|---|---|
| usePageCoordinateSystem | Boolean | True |
true to use the page coordinate system; otherwise, false.
|
| Type | Description |
|---|---|
| PdfRedactAnnotationFacade |
An object that contains redaction annotation properties.
|
The following code snippet searches for a specific word and creates a redaction annotation at its location:
using DevExpress.Pdf;
PdfDocumentProcessor pdfProcessor = new PdfDocumentProcessor();
pdfProcessor.LoadDocument("Demo.pdf");
PdfDocumentFacade documentFacade = pdfProcessor.DocumentFacade;
PdfTextSearchResults results = pdfProcessor.FindText("Anders");
// If the text is found, create an annotation
if (results.Status == PdfTextSearchStatus.Found)
{
var pageIndex = results.Page.GetPageIndex();
PdfRedactAnnotationFacade redactAnnotation =
documentFacade.Pages[pageIndex].AddRedactAnnotation(results.Rectangles[0]);
redactAnnotation.Author = "Jane Doe";
// Set up 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 results As PdfTextSearchResults = pdfProcessor.FindText("Anders")
' If the text is found, create an annotation
If results.Status = PdfTextSearchStatus.Found Then
Dim pageIndex = results.Page.GetPageIndex()
Dim redactAnnotation As PdfRedactAnnotationFacade = documentFacade.Pages(pageIndex).AddRedactAnnotation(results.Rectangles(0))
redactAnnotation.Author = "Jane Doe"
' Set up 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
End If
' Save the document with the redaction annotation and send it for review
pdfProcessor.SaveDocument("output_to_review.pdf")
See Also