TextFormattingSearchCriteria

TextFormattingSearchCriteria class

Represents criteria allowing filtering by text formatting.

public class TextFormattingSearchCriteria : SearchCriteria

Constructors

Name Description
TextFormattingSearchCriteria() Initializes a new instance of the TextFormattingSearchCriteria class.

Properties

Name Description
BackgroundColorRange { get; set; } Gets or sets the range of colors which are used to filter watermarks by text background color.
FontBold { get; set; } Gets or sets a value indicating whether the font used in watermark text formatting is bold.
FontItalic { get; set; } Gets or sets a value indicating whether the font used in watermark text formatting is italic.
FontName { get; set; } Gets or sets the name of the font which is used in possible watermark text formatting.
FontStrikeout { get; set; } Gets or sets a value indicating whether the font used in watermark text formatting is strikeout.
FontUnderline { get; set; } Gets or sets a value indicating whether the font used in watermark text formatting is underline.
ForegroundColorRange { get; set; } Gets or sets the range of colors which are used to filter watermarks by text foreground color.
MaxFontSize { get; set; } Gets or sets the ending value of the font size.
MinFontSize { get; set; } Gets or sets the starting value of the font size.

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

Remove possible watermarks with a particular text formatting (regardless of document type).

using (Watermarker watermarker = new Watermarker(@"D:\test.doc"))
{
    TextFormattingSearchCriteria criteria = new TextFormattingSearchCriteria();
    criteria.ForegroundColorRange = new ColorRange();
    criteria.ForegroundColorRange.MinHue = -5;
    criteria.ForegroundColorRange.MaxHue = 10;
    criteria.ForegroundColorRange.MinBrightness = 0.01f;
    criteria.ForegroundColorRange.MaxBrightness = 0.99f;
    criteria.BackgroundColorRange = new ColorRange();
    criteria.BackgroundColorRange.IsEmpty = true;
    criteria.FontName = "Arial";
    criteria.MinFontSize = 19;
    criteria.MaxFontSize = 42;
    criteria.FontBold = true;

    PossibleWatermarkCollection watermarks = watermarker.Search(criteria);
    watermarks.Clear();
    watermarker.Save();
}

See Also