ExactPhraseRedaction
Contents
[
Hide
]
ExactPhraseRedaction class
Represents a text redaction that replaces exact phrase in the document’s text, case insensitive by default.
public class ExactPhraseRedaction : TextRedaction
Constructors
Name | Description |
---|---|
ExactPhraseRedaction(string, ReplacementOptions) | Initializes a new instance of ExactPhraseRedaction class in case insensitive mode. |
ExactPhraseRedaction(string, bool, ReplacementOptions) | Initializes a new instance of ExactPhraseRedaction class. |
Properties
Name | Description |
---|---|
ActionOptions { get; } | Gets the ReplacementOptions instance, specifying type of text replacement. |
override Description { get; } | Returns a string, describing the redaction and its parameters. |
IsCaseSensitive { get; } | Gets a value indicating whether the search is case-sensitive or not. |
IsRightToLeft { get; set; } | Gets or sets a value indicating if this text is right-to-Left or not, false by default. |
OcrConnector { get; set; } | Gets or sets the IOcrConnector implementation, required to extract text from graphic content. |
SearchPhrase { get; } | Gets the string to search and replace. |
Methods
Name | Description |
---|---|
override ApplyTo(DocumentFormatInstance) | Applies the redaction to a given format instance. |
Remarks
Learn more
- More details about applying redactions: Redaction basics
- More details about document text redactions: Text redactions
Examples
The following example demonstrates performing case-sensitive phrase search and replacement.
using (Redactor redactor = new Redactor(@"C:\sample.pdf"))
{
// By default, isCaseSensitive = false;
doc.Apply(new ExactPhraseRedaction("John Doe", true /*isCaseSensitive*/, new ReplacementOptions("[personal]")));
doc.Save();
}
The following example demonstrates replacing phrase (case insensitive) with solid red rectangle.
using (Redactor redactor = new Redactor(@"C:\sample.pdf"))
{
// By default, isCaseSensitive = false;
doc.Apply(new ExactPhraseRedaction("John Doe", new ReplacementOptions(System.Drawing.Color.Red)));
doc.Save();
}
See Also
- class TextRedaction
- namespace GroupDocs.Redaction.Redactions
- assembly GroupDocs.Redaction