Merger
Inheritance: java.lang.Object
public class Merger
Represents the main class that controls the document merging process.
Constructors
Constructor | Description |
---|---|
Merger(InputStream document) | Initializes new instance of Merger class. |
Merger(InputStream document, ILoadOptions loadOptions) | Initializes new instance of Merger class. |
Merger(InputStream document, MergerSettings settings) | Initializes new instance of Merger class. |
Merger(InputStream document, ILoadOptions loadOptions, MergerSettings settings) | Initializes new instance of Merger class. |
Merger(String filePath) | Initializes new instance of Merger class. |
Merger(String filePath, ILoadOptions loadOptions) | Initializes new instance of Merger class. |
Merger(String filePath, MergerSettings settings) | Initializes new instance of Merger class. |
Merger(String filePath, ILoadOptions loadOptions, MergerSettings settings) | Initializes new instance of Merger class. |
Methods
Method | Description |
---|---|
dispose() | Disposes resources. |
importDocument(IImportDocumentOptions importDocumentOptions) | Imports the document as attachment or embedded via Ole. |
join(InputStream document) | Joins the documents into one single document. |
join(InputStream document, IJoinOptions joinOptions) | Joins the documents into one single document. |
join(InputStream document, IPageJoinOptions joinOptions) | Joins the documents into one single document. |
join(InputStream document, IImageJoinOptions joinOptions) | Joins the documents into one single document. |
join(String filePath) | Joins the documents into one single document. |
join(String filePath, IJoinOptions joinOptions) | Joins the documents into one single document. |
join(String filePath, IPageJoinOptions joinOptions) | Joins the documents into one single document. |
join(String filePath, IImageJoinOptions joinOptions) | Joins the documents into one single document. |
createPageBuilder() | Creates a new Page builder with predefined document collection. |
createPageBuilder(PageBuilderOptions pageBuilderOptions) | Creates a new Page builder with predefined document collection. |
applyPageBuilder(PageBuilder pageBuilder) | Applies page builder changes. |
split(ISplitOptions splitOptions) | Splits the single document to the multiple documents. |
split(ITextSplitOptions splitOptions) | Splits the single document to the multiple documents. |
extractPages(IExtractOptions extractOptions) | Makes a new document with some pages from the source document. |
addPassword(IAddPasswordOptions addPasswordOptions) | Protects document with password. |
isPasswordSet() | Checks whether document is password protected. |
removePassword() | Removes password from document. |
updatePassword(IUpdatePasswordOptions updatePasswordOptions) | Updates existing password for document. |
changeOrientation(IOrientationOptions orientationOptions) | Applies a new orientation mode for the specified pages. |
movePage(IMoveOptions moveOptions) | Moves page to a new position within document of known format. |
removePages(IRemoveOptions removeOptions) | Removes pages from document of known format. |
swapPages(ISwapOptions swapOptions) | Swaps two pages within document of known format. |
rotatePages(IRotateOptions rotateOptions) | Rotate pages of the document. |
getDocumentInfo() | Gets information about document pages: their sizes, maximum page height, the width of a page with the maximum height. |
generatePreview(IPreviewOptions previewOptions) | Generates document pages preview. |
save(OutputStream document) | Saves the result document to the stream document . |
save(String filePath) | Saves the result document file to filePath . |
save(String filePath, boolean useDefaultDirectory) | Saves the result document file to filePath . |
Merger(InputStream document)
public Merger(InputStream document)
Initializes new instance of Merger class.
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | The readable stream. |
Merger(InputStream document, ILoadOptions loadOptions)
public Merger(InputStream document, ILoadOptions loadOptions)
Initializes new instance of Merger class.
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | The readable stream. |
loadOptions | ILoadOptions | The document load options. |
Merger(InputStream document, MergerSettings settings)
public Merger(InputStream document, MergerSettings settings)
Initializes new instance of Merger class.
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | The readable stream. |
settings | MergerSettings | The Merger settings. |
Merger(InputStream document, ILoadOptions loadOptions, MergerSettings settings)
public Merger(InputStream document, ILoadOptions loadOptions, MergerSettings settings)
Initializes new instance of Merger class.
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | The readable stream. |
loadOptions | ILoadOptions | The document load options. |
settings | MergerSettings | The Merger settings. |
Merger(String filePath)
public Merger(String filePath)
Initializes new instance of Merger class.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The file path. |
Merger(String filePath, ILoadOptions loadOptions)
public Merger(String filePath, ILoadOptions loadOptions)
Initializes new instance of Merger class.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The file path. |
loadOptions | ILoadOptions | The document load options. |
Merger(String filePath, MergerSettings settings)
public Merger(String filePath, MergerSettings settings)
Initializes new instance of Merger class.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The file path. |
settings | MergerSettings | The Merger settings. |
Merger(String filePath, ILoadOptions loadOptions, MergerSettings settings)
public Merger(String filePath, ILoadOptions loadOptions, MergerSettings settings)
Initializes new instance of Merger class.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The file path. |
loadOptions | ILoadOptions | The document load options. |
settings | MergerSettings | The Merger settings. |
dispose()
public final void dispose()
Disposes resources.
importDocument(IImportDocumentOptions importDocumentOptions)
public final void importDocument(IImportDocumentOptions importDocumentOptions)
Imports the document as attachment or embedded via Ole.
Parameters:
Parameter | Type | Description |
---|---|---|
importDocumentOptions | IImportDocumentOptions | The embedded document import options. |
Learn more
- More about adding attachment to PDF documents: How to add attachment to PDF document.
- More about adding document to Word processing via OLE: Add document to Word processing via OLE.
- More about adding document to Presentation via OLE: Add document to Presentation via OLE.
- More about adding document to Spreadsheet via OLE: Add document to Spreadsheet via OLE.
- More about adding document to Diagram via OLE: [Add document to Diagram via OLE.][]
[Add document to Diagram via OLE.]: https://docs.groupdocs.com/merger/java/add-document-to-diagram-via-ole/ |
join(InputStream document)
public final void join(InputStream document)
Joins the documents into one single document.
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | Joined document. |
Learn more
- More about document merge scenarios and use cases: [How to merge PDF, Word, Excel and PowerPoint documents in 3 steps][How to merge PDF_ Word_ Excel and PowerPoint documents in 3 steps]
[How to merge PDF_ Word_ Excel and PowerPoint documents in 3 steps]: https://docs.groupdocs.com/merger/java/merge-files/ |
join(InputStream document, IJoinOptions joinOptions)
public final void join(InputStream document, IJoinOptions joinOptions)
Joins the documents into one single document.
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | Joined document. |
joinOptions | IJoinOptions | The join options. |
Learn more
- More about document merge scenarios and use cases: [How to merge PDF, Word, Excel and PowerPoint documents in 3 steps][How to merge PDF_ Word_ Excel and PowerPoint documents in 3 steps]
[How to merge PDF_ Word_ Excel and PowerPoint documents in 3 steps]: https://docs.groupdocs.com/merger/java/merge-files/ |
join(InputStream document, IPageJoinOptions joinOptions)
public final void join(InputStream document, IPageJoinOptions joinOptions)
Joins the documents into one single document.
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | Joined document. |
joinOptions | IPageJoinOptions | The join options. |
Learn more
- |
join(InputStream document, IImageJoinOptions joinOptions)
public final void join(InputStream document, IImageJoinOptions joinOptions)
Joins the documents into one single document.
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | Joined document. |
joinOptions | IImageJoinOptions | The image join options. |
Learn more
- |
join(String filePath)
public final void join(String filePath)
Joins the documents into one single document.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | File path of the joined document. |
Learn more
- More about document merge scenarios and use cases: [How to merge PDF, Word, Excel and PowerPoint documents in 3 steps][How to merge PDF_ Word_ Excel and PowerPoint documents in 3 steps]
[How to merge PDF_ Word_ Excel and PowerPoint documents in 3 steps]: https://docs.groupdocs.com/merger/java/merge-files/ |
join(String filePath, IJoinOptions joinOptions)
public final void join(String filePath, IJoinOptions joinOptions)
Joins the documents into one single document.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | File path of the joined document. |
joinOptions | IJoinOptions | The join options. |
Learn more
- More about document merge scenarios and use cases: [How to merge PDF, Word, Excel and PowerPoint documents in 3 steps][How to merge PDF_ Word_ Excel and PowerPoint documents in 3 steps]
[How to merge PDF_ Word_ Excel and PowerPoint documents in 3 steps]: https://docs.groupdocs.com/merger/java/merge-files/ |
join(String filePath, IPageJoinOptions joinOptions)
public final void join(String filePath, IPageJoinOptions joinOptions)
Joins the documents into one single document.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | File path of the joined document. |
joinOptions | IPageJoinOptions | The join options. |
Learn more
- |
join(String filePath, IImageJoinOptions joinOptions)
public final void join(String filePath, IImageJoinOptions joinOptions)
Joins the documents into one single document.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | File path of the joined document. |
joinOptions | IImageJoinOptions | The image join options. |
Learn more
- |
createPageBuilder()
public final PageBuilder createPageBuilder()
Creates a new Page builder with predefined document collection.
Returns: PageBuilder - The created page builder.
createPageBuilder(PageBuilderOptions pageBuilderOptions)
public final PageBuilder createPageBuilder(PageBuilderOptions pageBuilderOptions)
Creates a new Page builder with predefined document collection.
Parameters:
Parameter | Type | Description |
---|---|---|
pageBuilderOptions | PageBuilderOptions |
Returns: PageBuilder - The created page builder.
applyPageBuilder(PageBuilder pageBuilder)
public final void applyPageBuilder(PageBuilder pageBuilder)
Applies page builder changes.
Parameters:
Parameter | Type | Description |
---|---|---|
pageBuilder | PageBuilder | The page builder. |
split(ISplitOptions splitOptions)
public final void split(ISplitOptions splitOptions)
Splits the single document to the multiple documents.
Parameters:
Parameter | Type | Description |
---|---|---|
splitOptions | ISplitOptions | The page split options. |
Learn more
- More about document split scenarios and use cases: How to split PDF, Word, Excel and PowerPoint documents in 3 lines of code
- Quick guide about how to split text files in different ways: [Split text files guide][]
[Split text files guide]: https://docs.groupdocs.com/merger/java/split-text-file/ |
split(ITextSplitOptions splitOptions)
public final void split(ITextSplitOptions splitOptions)
Splits the single document to the multiple documents.
Parameters:
Parameter | Type | Description |
---|---|---|
splitOptions | ITextSplitOptions | The text split options. |
Learn more
- More about document split scenarios and use cases: How to split PDF, Word, Excel and PowerPoint documents in 3 lines of code
- Quick guide about how to split text files in different ways: [Split text files guide][]
[Split text files guide]: https://docs.groupdocs.com/merger/java/split-text-file/ |
extractPages(IExtractOptions extractOptions)
public final void extractPages(IExtractOptions extractOptions)
Makes a new document with some pages from the source document.
Parameters:
Parameter | Type | Description |
---|---|---|
extractOptions | IExtractOptions | The page options. |
Learn more
- More about how to extract specific document pages or page range: [How to extract pages from PDF, Word, Excel and PowerPoint documents][How to extract pages from PDF_ Word_ Excel and PowerPoint documents]
[How to extract pages from PDF_ Word_ Excel and PowerPoint documents]: https://docs.groupdocs.com/merger/java/extract-pages/ |
addPassword(IAddPasswordOptions addPasswordOptions)
public final void addPassword(IAddPasswordOptions addPasswordOptions)
Protects document with password.
Parameters:
Parameter | Type | Description |
---|---|---|
addPasswordOptions | IAddPasswordOptions | The options for specifying the password. |
Learn more
- More about how to protect document with password: How to protect PDF, Word, Excel and PowerPoint documents with password
- More about how to update or change document password: How to change document password
- More about how to check document password protected or not: How to check document password protection
- More about how to remove document password: How to remove PDF, Word, Excel and PowerPoint documents password
How to remove PDF_ Word_ Excel and PowerPoint documents password: https://docs.groupdocs.com/merger/java/remove-document-password/ |
isPasswordSet()
public final boolean isPasswordSet()
Checks whether document is password protected.
Returns: boolean - Returns a value indicating whether document is protected or not.
Learn more
- More about how to protect document with password: How to protect PDF, Word, Excel and PowerPoint documents with password
- More about how to update or change document password: How to change document password
- More about how to check document password protected or not: How to check document password protection
- More about how to remove document password: How to remove PDF, Word, Excel and PowerPoint documents password
removePassword()
public final void removePassword()
Removes password from document.
Learn more
- More about how to protect document with password: How to protect PDF, Word, Excel and PowerPoint documents with password
- More about how to update or change document password: How to change document password
- More about how to check document password protected or not: How to check document password protection
- More about how to remove document password: How to remove PDF, Word, Excel and PowerPoint documents password
updatePassword(IUpdatePasswordOptions updatePasswordOptions)
public final void updatePassword(IUpdatePasswordOptions updatePasswordOptions)
Updates existing password for document.
Parameters:
Parameter | Type | Description |
---|---|---|
updatePasswordOptions | IUpdatePasswordOptions | The options for specifying the current/new passwords. |
Learn more
- More about how to protect document with password: How to protect PDF, Word, Excel and PowerPoint documents with password
- More about how to update or change document password: How to change document password
- More about how to check document password protected or not: How to check document password protection
- More about how to remove document password: How to remove PDF, Word, Excel and PowerPoint documents password
How to remove PDF_ Word_ Excel and PowerPoint documents password: https://docs.groupdocs.com/merger/java/remove-document-password/ |
changeOrientation(IOrientationOptions orientationOptions)
public final void changeOrientation(IOrientationOptions orientationOptions)
Applies a new orientation mode for the specified pages.
Parameters:
Parameter | Type | Description |
---|---|---|
orientationOptions | IOrientationOptions | The change orientation options. |
Learn more
- More about how to change orientation for Microsoft Word document pages: [How to change Microsoft Word document pages orientation][]
[How to change Microsoft Word document pages orientation]: https://docs.groupdocs.com/merger/java/change-page-orientation/ |
movePage(IMoveOptions moveOptions)
public final void movePage(IMoveOptions moveOptions)
Moves page to a new position within document of known format.
Parameters:
Parameter | Type | Description |
---|---|---|
moveOptions | IMoveOptions | The move options. |
Learn more
- More about how to move page to another position within document: [How to move PDF, Word, Excel and PowerPoint document pages][How to move PDF_ Word_ Excel and PowerPoint document pages]
[How to move PDF_ Word_ Excel and PowerPoint document pages]: https://docs.groupdocs.com/merger/java/move-page/ |
removePages(IRemoveOptions removeOptions)
public final void removePages(IRemoveOptions removeOptions)
Removes pages from document of known format.
Parameters:
Parameter | Type | Description |
---|---|---|
removeOptions | IRemoveOptions | The options for the numbers of pages to be removed. |
Learn more
- More about how to remove page from document: [How to remove page from PDF, Word, Excel or PowerPoint document][How to remove page from PDF_ Word_ Excel or PowerPoint document]
[How to remove page from PDF_ Word_ Excel or PowerPoint document]: https://docs.groupdocs.com/merger/java/remove-pages/ |
swapPages(ISwapOptions swapOptions)
public final void swapPages(ISwapOptions swapOptions)
Swaps two pages within document of known format.
Parameters:
Parameter | Type | Description |
---|---|---|
swapOptions | ISwapOptions | The swap options. |
Learn more
- More about how to swap pages positions within document: [How to swap pages inside PDF, Word, Excel or PowerPoint document][How to swap pages inside PDF_ Word_ Excel or PowerPoint document]
[How to swap pages inside PDF_ Word_ Excel or PowerPoint document]: https://docs.groupdocs.com/merger/java/swap-pages/ |
rotatePages(IRotateOptions rotateOptions)
public final void rotatePages(IRotateOptions rotateOptions)
Rotate pages of the document.
Parameters:
Parameter | Type | Description |
---|---|---|
rotateOptions | IRotateOptions | The options for the page rotating. |
Learn more
- More about how to rotate PDF document pages: [How to rotate PDF document pages][]
[How to rotate PDF document pages]: https://docs.groupdocs.com/merger/java/rotate-pages/ |
getDocumentInfo()
public final IDocumentInfo getDocumentInfo()
Gets information about document pages: their sizes, maximum page height, the width of a page with the maximum height.
Returns: IDocumentInfo - Information about document properties.
Learn more
- Learn more about document file type, pages count, size and many other format specific properties: How to get document info using GroupDocs.Merger
generatePreview(IPreviewOptions previewOptions)
public final void generatePreview(IPreviewOptions previewOptions)
Generates document pages preview.
Parameters:
Parameter | Type | Description |
---|---|---|
previewOptions | IPreviewOptions | The preview options. |
Learn more
- Learn more about how to generate previews for document pages: [How to generate document pages preview using GroupDocs.Merger][]
[How to generate document pages preview using GroupDocs.Merger]: https://docs.groupdocs.com/merger/java/generate-document-pages-preview/ |
save(OutputStream document)
public final void save(OutputStream document)
Saves the result document to the stream document .
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.OutputStream | The document stream. |
save(String filePath)
public final void save(String filePath)
Saves the result document file to filePath .
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The file name or full file path. |
save(String filePath, boolean useDefaultDirectory)
public final void save(String filePath, boolean useDefaultDirectory)
Saves the result document file to filePath .
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The file path or name in case of default directory usage. |
useDefaultDirectory | boolean | Use the default directory from settings. |