com.groupdocs.watermark

Class Watermarker

    • Constructor Detail

      • Watermarker

        public Watermarker(String filePath)

        Creates a new Watermarker class for a document from the specified file.

        Parameters:
        filePath - The file path to load document from.
        Throws:
        UnsupportedFileTypeException - Supplied document type is not supported.
      • Watermarker

        public Watermarker(String filePath,
                   LoadOptions options)

        Creates a new Watermarker class for a document from the specified file.

        Parameters:
        filePath - The file path to load document from.
        options - Additional options to use when loading a document.
        Throws:
        UnsupportedFileTypeException - Supplied document type is not supported.
      • Watermarker

        public Watermarker(String filePath,
                   WatermarkerSettings settings)

        Creates a new Watermarker class for a document from the specified file.

        Parameters:
        filePath - The file path to load document from.
        settings - Additional settings to use when working with loaded document.
        Throws:
        UnsupportedFileTypeException - Supplied document type is not supported.
      • Watermarker

        public Watermarker(String filePath,
                   LoadOptions options,
                   WatermarkerSettings settings)

        Creates a new Watermarker class for a document from the specified file.

        Parameters:
        filePath - The file path to load document from.
        options - Additional options to use when loading a document.
        settings - Additional settings to use when working with loaded document.
        Throws:
        UnsupportedFileTypeException - Supplied document type is not supported.
      • Watermarker

        public Watermarker(InputStream document)

        Creates a new Watermarker class for a document from the specified stream.

        Parameters:
        document - The stream to load document from.
        Throws:
        UnsupportedFileTypeException - Supplied document type is not supported.
      • Watermarker

        public Watermarker(InputStream document,
                   LoadOptions options)

        Creates a new Watermarker class for a document from the specified stream.

        Parameters:
        document - The stream to load document from.
        options - Additional options to use when loading a document.
        Throws:
        UnsupportedFileTypeException - Supplied document type is not supported.
      • Watermarker

        public Watermarker(InputStream document,
                   WatermarkerSettings settings)

        Creates a new Watermarker class for a document from the specified stream.

        Parameters:
        document - The stream to load document from.
        settings - Additional settings to use when working with loaded document.
        Throws:
        UnsupportedFileTypeException - Supplied document type is not supported.
      • Watermarker

        public Watermarker(InputStream document,
                   LoadOptions options,
                   WatermarkerSettings settings)

        Creates a new Watermarker class for a document from the specified stream.

        Parameters:
        document - The stream to load document from.
        options - Additional options to use when loading a document.
        settings - Additional settings to use when working with loaded document.
        Throws:
        UnsupportedFileTypeException - Supplied document type is not supported.
    • Method Detail

      • getSearchableObjects

        public final SearchableObjects getSearchableObjects()

        Gets the content objects that are to be included in a watermark search. Note, this property also specifies content objects which are used in image search. For more information see Search(SearchCriteria) and GetImages() methods.

        Returns:
        The objects that are to be included in a watermark search.
      • setSearchableObjects

        public final void setSearchableObjects(SearchableObjects value)

        Sets the content objects that are to be included in a watermark search. Note, this property also specifies content objects which are used in image search. For more information see Search(SearchCriteria) and GetImages() methods.

        Parameters:
        value - The objects that are to be included in a watermark search.
      • close

        public final void close()

        Disposes the current instance.

        Specified by:
        close in interface Closeable
        Specified by:
        close in interface AutoCloseable
      • getDocumentInfo

        public final IDocumentInfo getDocumentInfo()

        Gets the information about the format of loaded document.

        Returns:
        The IDocumentInfo instance that contains detected information.
      • add

        public final void add(Watermark watermark)

        Adds a watermark to the loaded document.

        Parameters:
        watermark - The watermark to add to the document.
      • add

        public final void add(Watermark watermark,
               WatermarkOptions options)

        Adds a watermark to the loaded document.

        Parameters:
        watermark - The watermark to add to the document.
        options - Additional options to use when adding the watermark.
      • remove

        public final void remove(PossibleWatermark possibleWatermark)

        Removes watermark from the document.

        Parameters:
        possibleWatermark - The watermark to remove.
      • remove

        public final void remove(PossibleWatermarkCollection possibleWatermarks)

        Removes all watermarks in the collection from the document.

        Parameters:
        possibleWatermarks - The collection of watermarks to remove.
      • save

        public final void save(String filePath)

        Saves the document to the specified file location.

        Parameters:
        filePath - The file path to save the document data to.
      • save

        public final void save(OutputStream document)

        Saves the document to the specified stream.

        Parameters:
        document - The stream to save the document data to.
      • save

        public final void save(String filePath,
                SaveOptions options)

        Saves the document to the specified file location.

        Parameters:
        filePath - The file path to save the document data to.
        options - Additional options to use when saving a document.
      • save

        public final void save(OutputStream document,
                SaveOptions options)

        Saves the document to the specified stream.

        Parameters:
        document - The stream to save the document data to.
        options - Additional options to use when saving a document.
      • generatePreview

        public final void generatePreview(PreviewOptions previewOptions)

        Generates preview images for the document.

        Parameters:
        previewOptions - Additional options to use when generating preview images.
      • search

        public final PossibleWatermarkCollection search()

        Searches all possible watermarks in the document. The search is conducted in objects specified in SearchableObjects.

        Returns:
        The collection of possible watermarks.
      • search

        public final PossibleWatermarkCollection search(SearchCriteria searchCriteria)

        Searches possible watermarks according to specified search criteria. The search is conducted in objects specified in SearchableObjects.

        Parameters:
        searchCriteria - The search criteria to use.
        Returns:
        The collection of possible watermarks.
      • getImages

        public final WatermarkableImageCollection getImages(ImageSearchCriteria searchCriteria)

        Finds images according to specified search criteria. The search is conducted in objects specified in SearchableObjects.

        Parameters:
        searchCriteria - The search criteria to use.
        Returns:
        The collection of found images.
      • getImages

        public final WatermarkableImageCollection getImages()

        Finds all images in the document. The search is conducted in objects specified in SearchableObjects.

        Returns:
        The collection of found images.
      • getContent

        public final <T extends Content> T getContent(Class<T> contentType)

        Returns the Content object for the loaded document.

        Returns:
        The Content object for the loaded document.

        T: The requested type of a Content object.