<repositories>
   <repository>
      <id>repository.groupdocs.com</id>
      <name>GroupDocs Repository</name>
      <url>https://releases.groupdocs.com/java/repo/</url>
   </repository>
</repositories>

<dependencies>
   <dependency>
      <groupId>com.groupdocs</groupId>
      <artifactId>groupdocs-merger</artifactId>
      <version>24.8</version>
   </dependency>
</dependencies>
copied!  
repositories {
    maven {
        url 'https://releases.groupdocs.com/java/repo/'
    }
}

compile(group: 'com.groupdocs', name: 'groupdocs-merger', version: '24.8')
copied!  
<ivysettings>
    <settings defaultResolver="chain"/>
    <resolvers>
        <chain name="chain">
            <ibiblio name="GroupDocs Repository" m2compatible="true" root="https://releases.groupdocs.com/java/repo/"/>
        </chain>
    </resolvers>
</ivysettings>

<dependency org="com.groupdocs" name="groupdocs-merger" rev="24.8">
   <artifact name="groupdocs-merger" ext="jar"/>
</dependency>
copied!  
resolvers += Resolver.url("GroupDocs Repository", url("https://releases.groupdocs.com/java/repo/"))

libraryDependencies += "com.groupdocs" % "groupdocs-merger" % "24.8"
copied!  

High Code Java API to Merge & Join Documents

Maven metadata URL

main-banner

Product Page Docs API Ref Examples Blog Releases Support License

GroupDocs.Merger for Java on-premise API for merging multiple documents into a single resultant file. Supports joining files of different extensions (formats) into a single format document. OLE object insertions can also be done. You can also change page order, remove desired pages, and split single document into multiple smaller files.

Merge Files

Merge HTML

Merge multiple HTML files into a single document, preserving text, images, tables, and other content.

Merge Images

Combine multiple image formats (JPG, PNG, BMP) into a single document with cross-format merging support.

Merge PDF

Merge multiple PDF files into one, preserving structure, images, and formatting without third-party software.

Merge Word Documents

Combine DOCX, DOC, and RTF files into a single Word document, with options to retain compliance and formatting.

Merge PowerPoint Presentations

Merge PPT, PPTX, and PPSX presentations while maintaining slides, animations, and embedded media.

Merge Excel

Merge Excel spreadsheets (XLS, XLSX) into a single file, preserving data, formulas, and charts.

Merge Text Files

Combine multiple text files (TXT, CSV) into a single document, preserving content structure.

Merge Archives

Merge multiple archive formats (ZIP, RAR) into a single archive or PDF file.

Merge TEX

Merge TEX files into a single document for academic and technical typesetting.

Merge EPUB

Combine EPUB files into a single eBook document.

Merge Open Document Files

Merge OpenDocument files like ODT, ODS, and ODP into a single file while preserving format and content.

Merge Pages from Various Documents

Combine specific pages from different document formats into a single file, offering precise control over page selection.

Merge Documents to DOC

Merge various document formats (PDF, PPT, XLS) into a DOC file for Word processing.

Merge Documents to PDF

Merge different file types (DOC, PPT, XLS) into a single PDF document for universal viewing.

Merge Pages in Arbitrary Order

Merge selected pages from multiple documents in any desired order for custom document creation.

Single Document Operations

Move Page

Allows you to move a specific page to a new position within a document by specifying the current and new page numbers.

Remove Pages

Enables the removal of a single page or multiple pages by specifying page numbers.

Split Document

Splits a document into multiple resultant documents by specifying page numbers or ranges.

Split Text File

Allows splitting a text file into multiple files based on line numbers or other split criteria.

Swap Pages

Enables swapping the positions of two specified pages within a document.

Extract Pages

Provides functionality to extract specific pages from a document into a new file.

Change Page Orientation

Allows changing the orientation (portrait or landscape) of specific or all pages in the document.

Rotate Pages

Enables rotating pages by 90, 180, or 270 degrees.

Generate Document Pages Preview

Allows generating preview images (PNG, JPG, BMP) of the pages of a document.

Import documents

How to add attachment to PDF document

Embeds attachments such as images, PDFs, or other files into a PDF document.

Add document to Word processing via OLE

Embeds documents like PDFs or spreadsheets into Word files via OLE.

Add document to Presentation via OLE

Embeds documents into PowerPoint presentations using OLE technology.

Add document to Spreadsheet via OLE

Embeds documents into Excel spreadsheets using OLE objects.

Add document to Diagram via OLE

Embeds documents into diagrams (such as Visio files) using OLE technology.

Security Operations

Add Document Password

Enables adding a password to documents to secure them from unauthorized access.

Check Document Password Protection

Verifies whether a document is protected by a password and returns a boolean value.

Remove Document Password

Removes the password from a password-protected document.

Update Document Password

Allows updating the existing password for a document, replacing the old one with a new password.

Loading

Load document from InputStream

GroupDocs.Merger allows loading documents directly from an InputStream without saving the document as a file.

Load document from local disk

Load documents from the local disk by specifying the file path using the Merger class.

Load document from URL

Documents can be loaded directly from a URL using an InputStream, enabling processing of remotely located documents.

Load password-protected document

Load documents protected with a password by specifying the password in the LoadOptions object.

Supported Audio Types

FormatDescriptionJoinSplitCross-format audio merging
WAVWAV Audio File✔️

Supported Document Types

FormatDescriptionJoinSplitExtract pagesMove pageRemove pagesSwap pagesChange page orientationRotate pagesImport documentCross-format merge to PDF / XPSCross-format merge to DOC / DOCX
DOCMicrosoft Word Document✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
DOCXMicrosoft Word Open XML Document✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
DOCMWord Open XML Macro-Enabled Document✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
DOTWord Document Template✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
DOTXWord Open XML Document Template✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
DOTMWord Open XML Macro-Enabled Document Template✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
RTFRich Text Format File✔️✔️✔️✔️✔️✔️✔️✔️✔️
ODTOpenDocument Text Document✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
OTTOpenDocument Document Template✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
HTMLHypertext Markup Language File✔️✔️✔️✔️✔️✔️✔️✔️
MHTMHTML Web Archive✔️✔️✔️✔️✔️✔️✔️
MHTMLMIME HTML✔️✔️✔️✔️✔️✔️✔️
PDFPortable Document Format File✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
XPSXML Paper Specification File✔️✔️✔️✔️✔️✔️✔️✔️
TEXLaTeX Source Document✔️✔️✔️✔️✔️✔️✔️✔️
EPUBOpen eBook File✔️✔️✔️✔️✔️✔️✔️✔️
PSPostScript File✔️
PPTMicrosoft PowerPoint 97-2003 Presentation✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
PPTXMicrosoft PowerPoint Presentation✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
PPSMicrosoft PowerPoint 97-2003 Slide Show✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
PPSXMicrosoft PowerPoint Slide Show✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
PPTMMicrosoft PowerPoint Macro-Enabled Presentation✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
ODPOpenDocument Presentation✔️✔️✔️✔️✔️✔️✔️✔️✔️
OTPOpenDocument Presentation Template✔️✔️✔️✔️✔️✔️✔️✔️✔️
XLSMicrosoft Excel 97-2003 Worksheet✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
XLSXMicrosoft Excel Worksheet✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
XLSBMicrosoft Excel Binary Worksheet✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
XLSMMicrosoft Excel Macro-Enabled Worksheet✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
XLTMicrosoft Excel Template File✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
XLTXExcel Open XML Spreadsheet Template✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
XLTMExcel Open XML Macro-Enabled Spreadsheet Template✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
XLAMExcel Open XML Macro-Enabled Add-in✔️✔️✔️✔️✔️✔️✔️✔️✔️✔️
ODSOpenDocument Spreadsheet✔️✔️✔️✔️✔️✔️✔️✔️✔️
VSDXMicrosoft Visio Drawing✔️✔️✔️✔️✔️✔️✔️✔️
VSDMMicrosoft Visio Macro-Enabled Drawing✔️✔️✔️✔️✔️✔️✔️✔️
VSSXMicrosoft Visio Stencil✔️✔️✔️✔️✔️✔️✔️✔️
VSSMMicrosoft Visio Macro-Enabled Stencil✔️✔️✔️✔️✔️✔️✔️✔️
VSTXMicrosoft Visio Template✔️✔️✔️✔️✔️✔️✔️✔️
VSTMMicrosoft Visio Macro-Enabled Template✔️✔️✔️✔️✔️✔️✔️✔️
VDXMicrosoft Visio 2003-2010 XML Drawing✔️✔️✔️✔️✔️✔️✔️✔️
VSXMicrosoft Visio 2003-2010 XML Stencil✔️✔️✔️✔️✔️✔️✔️✔️
VTXMicrosoft Visio 2003-2010 XML Template✔️✔️✔️✔️✔️✔️✔️✔️
ONEMicrosoft OneNote✔️✔️✔️✔️✔️✔️✔️✔️
TXTPlain Text File✔️✔️
ERRError Log File✔️✔️
CSVComma Separated Values File✔️✔️
TSVTab Separated Values File✔️✔️

Supported Archive Types

FormatDescriptionJoinSplitCross-format archive merging
ZIPZIP Archive File✔️✔️
TARTAR Archive File✔️✔️
7Z7Z Archive File✔️✔️

Supported Image Types

FormatDescriptionJoinSplitExtract pagesCross-format image mergingCross-format merge to PDF
JPGJPG Image File✔️✔️✔️
JPEGJPEG Image File✔️✔️✔️
BMPBitmap Image File✔️✔️✔️
PNGPortable Network Graphics✔️✔️✔️
GIFGraphical Interchange Format✔️✔️✔️
TIFTagged Image Format✔️✔️✔️✔️
TIFFTagged Image File Format✔️✔️✔️✔️
SVGScalar Vector Graphics✔️✔️✔️
SVGZCompressed Scalar Vector Graphics✔️✔️✔️
EMFWindows Enhanced Metafile✔️
EMZWindows Compressed Enhanced Metafile✔️

Supported Operating Systems

Windows

Windows 2003/2008/2012/2016/2019 Server (x64, x86)

Windows Vista, XP, 7, 8, 8.1, 10 (x64, x86)

Microsoft Azure

Linux

Ubuntu, OpenSUSE, CentOS, and others

Mac

macOS

Supported Java Versions

J2SE 8.0 (1.8) or higher (e.g., Java 10)

Supported Runtime

Java version 8+ (Kotlin supported)

Development Environments

NetBeans, IntelliJ IDEA, Eclipse

Installation from GroupDocs Repository

Java packages are hosted on the GroupDocs Artifact Repository. To add GroupDocs.Merger to your project:

1. Add GroupDocs Repository

<repositories>
   <repository>
      <id>repository.groupdocs.com</id>
      <name>GroupDocs Repository</name>
      <url>https://releases.groupdocs.com/java/repo/</url>
   </repository>
</repositories>

2. Add GroupDocs.Merger Dependency

<dependencies>
   <dependency>
      <groupId>com.groupdocs</groupId>
      <artifactId>groupdocs-merger</artifactId>
      <version>24.8</version>
   </dependency>
</dependencies>

Sample Java code to Join two Word® DOCX documents into one

String filePath = "c:\sample.docx";
String filePath2 = "c:\sample2.docx";
String filePathOut = "c:\output\result.docx";

JoinOptions joinOptions = new JoinOptions(1, 2);

Merger merger = new Merger(filePath);
merger.join(filePath2 , joinOptions);
merger.save(filePathOut);

Product Page Docs API Ref Examples Blog Releases Support License

VersionRelease Date
24.8August 19, 2024
24.6June 20, 2024
24.2February 20, 2024
23.10October 9, 2023
23.8August 1, 2023
23.2February 23, 2023
22.12December 12, 2022
22.7July 14, 2022
22.2February 16, 2022
21.9January 25, 2022
20.7January 25, 2022
19.2.1January 25, 2022
21.7July 1, 2021
21.3March 26, 2021
20.11November 9, 2020
20.4April 7, 2020
19.12December 24, 2019
19.8August 14, 2019
19.6June 14, 2019
19.2February 26, 2019
18.12December 24, 2018
18.8August 14, 2018