com.groupdocs.watermark

Interfaces

Classes

Exceptions

com.groupdocs.watermark

Class TextFormattingSearchCriteria



  • public class TextFormattingSearchCriteria
    extends SearchCriteria

    Represents criteria allowing filtering by text formatting.

    This example demonstrates how to remove possible watermarks with a particular text formatting (regardless of document type).

    String inputFolder = "D:\\docs\\input\\";
     String outputFolder = "D:\\docs\\output\\";
     TextFormattingSearchCriteria criteria = new TextFormattingSearchCriteria();
     criteria.setForegroundColorRange(new ColorRange());
     criteria.getForegroundColorRange().setMinHue(-5);
     criteria.getForegroundColorRange().setMaxHue(10);
     criteria.getForegroundColorRange().setMinBrightness(0.01f);
     criteria.getForegroundColorRange().setMaxBrightness(0.99f);
     criteria.setBackgroundColorRange(new ColorRange());
     criteria.getBackgroundColorRange().setEmpty(true);
     criteria.setFontName("Arial");
     criteria.setMinFontSize(19);
     criteria.setMaxFontSize(42);
     File[] files = new File(inputFolder).listFiles();
     for (File file : files)
     {
         if (file.isFile())
         {
             Document doc = Document.load(file.getAbsolutePath());                   
             PossibleWatermarkCollection watermarks = doc.findWatermarks(criteria);
             watermarks.clear();
             doc.save(outputFolder + file.getName()); 
         }
     }
     
    • Constructor Detail

      • TextFormattingSearchCriteria

        public TextFormattingSearchCriteria()
    • Method Detail

      • getForegroundColorRange

        public final ColorRange getForegroundColorRange()

        Gets the range of colors which are used to filter watermarks by text foreground color.

        Returns:
        The range of colors which are used to filter watermarks by text foreground color.
      • setForegroundColorRange

        public final void setForegroundColorRange(ColorRange value)

        Sets the range of colors which are used to filter watermarks by text foreground color.

        Parameters:
        value - The range of colors which are used to filter watermarks by text foreground color.
      • getBackgroundColorRange

        public final ColorRange getBackgroundColorRange()

        Gets the range of colors which are used to filter watermarks by text background color.

        Returns:
        The range of colors which are used to filter watermarks by text background color.
      • setBackgroundColorRange

        public final void setBackgroundColorRange(ColorRange value)

        Sets the range of colors which are used to filter watermarks by text background color.

        Parameters:
        value - The range of colors which are used to filter watermarks by text background color.
      • getFontName

        public final String getFontName()

        Gets the name of the font which is used in possible watermark text formatting.

        Returns:
        The default value is null, which means that the filter is not applied.
      • setFontName

        public final void setFontName(String value)

        Sets the name of the font which is used in possible watermark text formatting.

        Parameters:
        value - The default value is null, which means that the filter is not applied.
      • getMinFontSize

        public final float getMinFontSize()

        Gets the starting value of the font size.

        Returns:
        The starting value of the font size.
      • setMinFontSize

        public final void setMinFontSize(float value)

        Sets the starting value of the font size.

        Parameters:
        value - The starting value of the font size.
      • getMaxFontSize

        public final float getMaxFontSize()

        Gets the ending value of the font size.

        Returns:
        The ending value of the font size.
      • setMaxFontSize

        public final void setMaxFontSize(float value)

        Sets the ending value of the font size.

        Parameters:
        value - The ending value of the font size.
      • getFontBold

        public final Boolean getFontBold()

        Gets a value indicating whether the font used in watermark text formatting is bold.

        Returns:
        The default value is null, which means that the filter is not applied.
      • setFontBold

        public final void setFontBold(Boolean value)

        Sets a value indicating whether the font used in watermark text formatting is bold.

        Parameters:
        value - The default value is null, which means that the filter is not applied.
      • getFontItalic

        public final Boolean getFontItalic()

        Gets a value indicating whether the font used in watermark text formatting is italic.

        Returns:
        The default value is null, which means that the filter is not applied.
      • setFontItalic

        public final void setFontItalic(Boolean value)

        Sets a value indicating whether the font used in watermark text formatting is italic.

        Parameters:
        value - The default value is null, which means that the filter is not applied.
      • getFontUnderline

        public final Boolean getFontUnderline()

        Gets a value indicating whether the font used in watermark text formatting is underline.

        Returns:
        The default value is null, which means that the filter is not applied.
      • setFontUnderline

        public final void setFontUnderline(Boolean value)

        Sets a value indicating whether the font used in watermark text formatting is underline.

        Parameters:
        value - The default value is null, which means that the filter is not applied.
      • getFontStrikeout

        public final Boolean getFontStrikeout()

        Gets a value indicating whether the font used in watermark text formatting is strikeout.

        Returns:
        The default value is null, which means that the filter is not applied.
      • setFontStrikeout

        public final void setFontStrikeout(Boolean value)

        Sets a value indicating whether the font used in watermark text formatting is strikeout.

        Parameters:
        value - The default value is null, which means that the filter is not applied.