PdfRedactAnnotationFacade.OverlayText Property
Gets or sets a text displayed in the redaction annotation.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Pdf.v25.1.Core.dll
NuGet Package: DevExpress.Pdf.Core
Declaration
Property Value
Type | Description |
---|---|
String | The overlay text. |
Remarks
Use the FillColor property to specify the annotation’s fill color. The FillColor
and OverlayText
properties can be specified independently.
The following text parameters are available:
- Font name and size
- Text color
- Make text bold or italic
- Alignment
- Repeat text
Example
The following code snippet searches for specific words and creates redaction annotations over them:
using DevExpress.Pdf;
PdfDocumentProcessor pdfProcessor = new PdfDocumentProcessor();
pdfProcessor.LoadDocument("..\\..\\Invoice.pdf");
PdfDocumentFacade documentFacade = pdfProcessor.DocumentFacade;
PdfTextSearchParameters searchParameters =
new PdfTextSearchParameters();
searchParameters.CaseSensitive = true;
searchParameters.WholeWords = true;
string[] search = new string[] { "Maria Anders", "030-0074321", "alfredsfutterkiste@mail.com" };
foreach (string word in search)
{
PdfTextSearchResults results = pdfProcessor.FindText(word, searchParameters);
// 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);
redactAnnotation.Author = "Jane Doe";
// Set the redaction annotation appearance
redactAnnotation.FontColor = new PdfRGBColor(0, 0, 0);
redactAnnotation.FillColor = new PdfRGBColor(1, 1, 1);
redactAnnotation.FontName = "Arial";
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");
See Also