com.groupdocs.merger

Class Merger

  • All Implemented Interfaces:
    com.aspose.ms.System.IDisposable


    public class Merger
    extends Object
    implements com.aspose.ms.System.IDisposable

    Represents main class that controls document merging process.

    • Constructor Detail

      • Merger

        public Merger(InputStream document)
               throws Exception

        Initializes new instance of Merger class.

        Parameters:
        document - The readable stream.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when document is null.
        Exception
      • Merger

        public Merger(InputStream document,
              ILoadOptions loadOptions)
               throws Exception

        Initializes new instance of Merger class.

        Parameters:
        document - The readable stream.
        loadOptions - The document load options.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when document is null.
        com.aspose.ms.System.ArgumentNullException - Thrown when loadOptions is null.
        Exception
      • Merger

        public Merger(InputStream document,
              ILoadOptions loadOptions,
              MergerSettings settings)
               throws Exception

        Initializes new instance of Merger class.

        Parameters:
        document - The readable stream.
        loadOptions - The document load options.
        settings - The Merger settings.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when document is null.
        com.aspose.ms.System.ArgumentNullException - Thrown when loadOptions is null.
        com.aspose.ms.System.ArgumentNullException - Thrown when settings is null.
        Exception
      • Merger

        public Merger(InputStream document,
              MergerSettings settings)
               throws Exception

        Initializes new instance of Merger class.

        Parameters:
        document - The readable stream.
        settings - The Merger settings.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when document is null.
        com.aspose.ms.System.ArgumentNullException - Thrown when settings is null.
        Exception
      • Merger

        public Merger(String filePath)
               throws Exception

        Initializes new instance of Merger class.

        Parameters:
        filePath - The file path.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when filePath is null or empty.
        Exception
      • Merger

        public Merger(String filePath,
              ILoadOptions loadOptions)
               throws Exception

        Initializes new instance of Merger class.

        Parameters:
        filePath - The file path.
        loadOptions - The document load options.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when filePath is null or empty.
        com.aspose.ms.System.ArgumentNullException - Thrown when loadOptions is null.
        Exception
      • Merger

        public Merger(String filePath,
              ILoadOptions loadOptions,
              MergerSettings settings)
               throws Exception

        Initializes new instance of Merger class.

        Parameters:
        filePath - The file path.
        loadOptions - The document load options.
        settings - The Merger settings.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when filePath is null or empty.
        com.aspose.ms.System.ArgumentNullException - Thrown when loadOptions is null.
        com.aspose.ms.System.ArgumentNullException - Thrown when settings is null.
        Exception
      • Merger

        public Merger(String filePath,
              MergerSettings settings)
               throws Exception

        Initializes new instance of Merger class.

        Parameters:
        filePath - The file path.
        settings - The Merger settings.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when filePath is null or empty.
        com.aspose.ms.System.ArgumentNullException - Thrown when settings is null.
        Exception
    • Method Detail

      • addPassword

        public final void addPassword(IAddPasswordOptions addPasswordOptions)
                               throws Exception

        Protects document with password.

        Parameters:
        addPasswordOptions - The options for specifying the password.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when addPasswordOptions is null.
        Exception
      • changeOrientation

        public final void changeOrientation(IOrientationOptions orientationOptions)
                                     throws Exception

        Applies a new orientation mode for the specified pages.

        Parameters:
        orientationOptions - The change orientation options.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when orientationOptions is null.
        Exception
      • dispose

        public final void dispose()

        Disposes resources.

        Specified by:
        dispose in interface com.aspose.ms.System.IDisposable
      • extractPages

        public final void extractPages(IExtractOptions extractOptions)
                                throws Exception

        Makes a new document with some pages from the source document.

        Parameters:
        extractOptions - The page options.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when extractOptions is null.
        Exception
      • generatePreview

        public final void generatePreview(IPreviewOptions previewOptions)
                                   throws Exception

        Generates document pages preview.

        Parameters:
        previewOptions - The preview options.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when previewOptions is null.
        Exception
      • getDocumentInfo

        public final IDocumentInfo getDocumentInfo()
                                            throws Exception

        Gets information about document pages: their sizes, maximum page height, the width of a page with the maximum height.

        Returns:
        Information about document properties.
        Throws:
        Exception
      • isPasswordSet

        public final boolean isPasswordSet()
                                    throws Exception

        Checks whether document is password protected.

        Returns:
        Returns a value indicating whether document is protected or not.
        Throws:
        Exception
      • join

        public final void join(InputStream document)
                        throws Exception

        Joins the documents into one single document.

        Parameters:
        document - Joined document.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when document is null.
        Exception
      • join

        public final void join(InputStream document,
                IJoinOptions joinOptions)
                        throws Exception

        Joins the documents into one single document.

        Parameters:
        document - Joined document.
        joinOptions - The join options.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when document is null.
        com.aspose.ms.System.ArgumentNullException - Thrown when joinOptions is null.
        Exception
      • join

        public final void join(String filePath)
                        throws Exception

        Joins the documents into one single document.

        Parameters:
        filePath - File path of the joined document.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when filePath is null or empty.
        Exception
      • join

        public final void join(String filePath,
                IJoinOptions joinOptions)
                        throws Exception

        Joins the documents into one single document.

        Parameters:
        filePath - File path of the joined document.
        joinOptions - The join options.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when filePath is null or empty.
        com.aspose.ms.System.ArgumentNullException - Thrown when joinOptions is null.
        Exception
      • movePage

        public final void movePage(IMoveOptions moveOptions)
                            throws Exception

        Moves page to a new position within document of known format.

        Parameters:
        moveOptions - The move options.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when moveOptions is null.
        Exception
      • removePages

        public final void removePages(IRemoveOptions removeOptions)
                               throws Exception

        Removes pages from document of known format.

        Parameters:
        removeOptions - The options for the numbers of pages to be removed.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when removeOptions is null.
        Exception
      • removePassword

        public final void removePassword()
                                  throws Exception

        Removes password from document.

        Throws:
        Exception
      • rotatePages

        public final void rotatePages(IRotateOptions rotateOptions)
                               throws Exception

        Rotate pages of the document.

        Parameters:
        rotateOptions - The options for the page rotating.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when rotateOptions is null.
        Exception
      • save

        public final void save(OutputStream document)
                        throws Exception

        Saves the result document to the stream document.

        Parameters:
        document - The document stream.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when document is null.
        Exception
      • save

        public final void save(String filePath)
                        throws Exception

        Saves the result document file to filePath.

        Parameters:
        filePath - The file name or full file path.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when filePath is null or empty.
        Exception
      • save

        public final void save(String filePath,
                boolean useDefaultDirectory)
                        throws Exception

        Saves the result document file to filePath.

        Parameters:
        filePath - The file path or name in case of default directory usage.
        useDefaultDirectory - Use the default directory from settings.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when filePath is null or empty.
        Exception
      • split

        public final void split(ISplitOptions splitOptions)
                         throws Exception

        Splits the single document to the multiple documents.

        Parameters:
        splitOptions - The page split options.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when splitOptions is null.
        Exception
      • split

        public final void split(ITextSplitOptions splitOptions)
                         throws Exception

        Splits the single document to the multiple documents.

        Parameters:
        splitOptions - The text split options.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when splitOptions is null.
        Exception
      • swapPages

        public final void swapPages(ISwapOptions swapOptions)
                             throws Exception

        Swaps two pages within document of known format.

        Parameters:
        swapOptions - The swap options.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when swapOptions is null.
        Exception
      • updatePassword

        public final void updatePassword(IUpdatePasswordOptions updatePasswordOptions)
                                  throws Exception

        Updates existing password for document.

        Parameters:
        updatePasswordOptions - The options for specifying the current/new passwords.
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when updatePasswordOptions is null.
        Exception