TextSearchCriteria

TextSearchCriteria class

Represents criteria allowing filtering by watermark text.

public class TextSearchCriteria : PageSearchCriteria

Constructors

Name Description
TextSearchCriteria(Regex) Initializes a new instance of the TextSearchCriteria class with a specified regular expression.
TextSearchCriteria(string) Initializes a new instance of the TextSearchCriteria class with a search string.
TextSearchCriteria(string, bool) Initializes a new instance of the TextSearchCriteria class with a search string and a flag for comparison.

Properties

Name Description
Pages { get; set; } Gets or sets the list of specific page numbers
Pattern { get; } Gets the search pattern.
SkipUnreadableCharacters { get; set; } Gets or sets a value indicating that unreadable characters will be skipped during string comparison.

Methods

Name Description
And(SearchCriteria) Combines this SearchCriteria with other criteria using logical AND operator.
Not() Negates this SearchCriteria.
Or(SearchCriteria) Combines this SearchCriteria with other criteria using logical OR operator.

Remarks

Learn more:

Examples

Find and remove watermark using search criteria.

using (Watermarker watermarker = new Watermarker(@"C:\test.some_ext"))
{
    SizeSearchCriteria widthRange = new SizeSearchCriteria(Dimension.Width, 50, 100);
    RotateAngleSearchCriteria rotateAngle = new RotateAngleSearchCriteria(0, 45);
    TextSearchCriteria textCriteria = new TextSearchCriteria(new Regex("^Test watermark$"));
    PossibleWatermarkCollection watermarks = watermarker.Search(textCriteria.And(widthRange.Or(rotateAngle)));
    watermarks.Clear();
    watermarker.Save();
}

See Also