TextSearchCriteria
Inheritance: java.lang.Object, com.groupdocs.watermark.search.SearchCriteria
public class TextSearchCriteria extends SearchCriteria
Represents criteria allowing filtering by watermark text.
Learn more:
The following example demonstrates how to find and remove watermark using search criteria.
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(Pattern.compile("^Test watermark$"));
PossibleWatermarkCollection watermarks = watermarker.search(textCriteria.and(widthRange.or(rotateAngle))); watermarks.clear();
watermarker.save(“C:\modified_test.some_ext”); watermarker.close();
Constructors
Constructor | Description |
---|---|
TextSearchCriteria(Pattern pattern) | Initializes a new instance of the [TextSearchCriteria](../../com.groupdocs.watermark.search/textsearchcriteria) class with a specified regular expression. |
TextSearchCriteria(System.Text.RegularExpressions.Regex pattern) | |
TextSearchCriteria(String searchString, boolean isMatchCase) | Initializes a new instance of the [TextSearchCriteria](../../com.groupdocs.watermark.search/textsearchcriteria) class with a search string and a flag for comparison. |
TextSearchCriteria(String searchString) | Initializes a new instance of the [TextSearchCriteria](../../com.groupdocs.watermark.search/textsearchcriteria) class with a search string. |
Methods
Method | Description |
---|---|
getPattern() | Gets the search pattern. |
getPatternInternal() | |
getSkipUnreadableCharacters() | Gets a value indicating that unreadable characters will be skipped during string comparison. |
setSkipUnreadableCharacters(boolean value) | Sets a value indicating that unreadable characters will be skipped during string comparison. |
isSatisfiedBy(PossibleWatermark candidate) | |
accept(ICriteriaVisitor visitor) |
TextSearchCriteria(Pattern pattern)
public TextSearchCriteria(Pattern pattern)
Initializes a new instance of the [TextSearchCriteria](../../com.groupdocs.watermark.search/textsearchcriteria)
class with a specified regular expression.
Parameters:
Parameter | Type | Description |
---|---|---|
pattern | java.util.regex.Pattern | The regular expression to match. |
TextSearchCriteria(System.Text.RegularExpressions.Regex pattern)
public TextSearchCriteria(System.Text.RegularExpressions.Regex pattern)
Parameters:
Parameter | Type | Description |
---|---|---|
pattern | com.aspose.ms.System.Text.RegularExpressions.Regex |
TextSearchCriteria(String searchString, boolean isMatchCase)
public TextSearchCriteria(String searchString, boolean isMatchCase)
Initializes a new instance of the [TextSearchCriteria](../../com.groupdocs.watermark.search/textsearchcriteria)
class with a search string and a flag for comparison.
Parameters:
Parameter | Type | Description |
---|---|---|
searchString | java.lang.String | The exact string to search for. |
isMatchCase | boolean | false to ignore case during the comparison; otherwise, true . |
TextSearchCriteria(String searchString)
public TextSearchCriteria(String searchString)
Initializes a new instance of the [TextSearchCriteria](../../com.groupdocs.watermark.search/textsearchcriteria)
class with a search string.
Parameters:
Parameter | Type | Description |
---|---|---|
searchString | java.lang.String | The exact string to search for. |
getPattern()
public final Pattern getPattern()
Gets the search pattern.
Returns: java.util.regex.Pattern - The regular expression pattern to match.
getPatternInternal()
public final System.Text.RegularExpressions.Regex getPatternInternal()
Returns: com.aspose.ms.System.Text.RegularExpressions.Regex
getSkipUnreadableCharacters()
public final boolean getSkipUnreadableCharacters()
Gets a value indicating that unreadable characters will be skipped during string comparison.
Returns: boolean - A value indicating that unreadable characters will be skipped during string comparison.
setSkipUnreadableCharacters(boolean value)
public final void setSkipUnreadableCharacters(boolean value)
Sets a value indicating that unreadable characters will be skipped during string comparison.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | A value indicating that unreadable characters will be skipped during string comparison. |
isSatisfiedBy(PossibleWatermark candidate)
public boolean isSatisfiedBy(PossibleWatermark candidate)
Parameters:
Parameter | Type | Description |
---|---|---|
candidate | PossibleWatermark |
Returns: boolean
accept(ICriteriaVisitor visitor)
public void accept(ICriteriaVisitor visitor)
Parameters:
Parameter | Type | Description |
---|---|---|
visitor | ICriteriaVisitor |