com.groupdocs.watermark.contents

Interfaces

Classes

com.groupdocs.watermark.contents

Class WordProcessingContent

  • All Implemented Interfaces:
    Closeable, AutoCloseable


    public class WordProcessingContent
    extends Content

    Class representing Word document (doc, docx etc) where watermark should be placed.

    This example demonstrates how to load and save Word content of any supported type.

    WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
     Watermarker watermarker = new Watermarker(@"D:\input.doc", loadOptions);
     // Use add method to add watermark to a particular or all sections.
     // Save changes.
     watermarker.save("D:\\output.doc");
     watermarker.close();
     
    • Method Detail

      • getSections

        public final WordProcessingSectionCollection getSections()

        Gets the collection of all sections of this WordProcessingContent.

        Returns:
        The collection of all sections of this WordProcessingContent.
      • getPageCount

        public final int getPageCount()

        Gets the number of pages in the document.

        Returns:
        The number of pages in the document.
      • encrypt

        public final void encrypt(String password)

        Encrypts the document.

        Parameters:
        password - The password that will be required to open the document.
      • decrypt

        public final void decrypt()

        Decrypts the document.

      • protect

        public final void protect(int protectionType,
                   String password)

        Protects the document from changes and sets a protection password. To have the content of the document editable use appropriate method of adding watermark with WordProcessingLockType.AllowOnlyFormFields or WordProcessingLockType.ReadOnlyWithEditableContent parameter.

        Parameters:
        protectionType - Specifies the protection type for the document.
        password - The password to protect the document with.
      • unprotect

        public final void unprotect()

        Removes protection from the document regardless of the password.

      • performSave

        public void performSave(OutputStream stream)

        Saves the document data to the specified stream.

        Specified by:
        performSave in class Content
        Parameters:
        stream - The stream to save the document data to.
      • performSave

        public void performSave(OutputStream stream,
                       SaveOptions saveOptions)

        Saves the document data to the specified stream.

        Specified by:
        performSave in class Content
        Parameters:
        stream - The stream to save the document data to.
        saveOptions - The options tha should be used when saving the content data.