GroupDocs.Merger at a glance

API to combine, split, swap, trim or remove documents, slides, and diagrams in Java applications

Illustration merger

Effortlessly merge multiple documents in Java

Easily merge PDF and Office files into a single document in Java, leveraging the capabilities of the GroupDocs.Merger library. Benefit from its extensive format support, allowing you to seamlessly combine various file types, resulting in a convenient and streamlined merging process.

Streamline document management by dividing bulky files easily

Split large PDF or Office files into smaller, easily handled sections. You may divide documents based on specific pages, ranges, or even extract individual pages with ease and convenience. Streamline your document management by utilizing the seamless capabilities of the GroupDocs.Merger library and make your files more organized and manageable.

Customize your document structure and have full control over your files

Easily manipulate pages by reordering, swapping, or removing them. Organize and tailor your documents according to your specific requirements with the flexibility to create a personalized file structure.

Platform independence

GroupDocs.Merger for Java supports the following operating systems, frameworks and package managers

Amazon
Docker
Azure
Eclipse
IntelliJ
Windows
Linux
Maven

Supported file formats

GroupDocs.Merger for Java supports operations with the following file formats.

Microsoft Office formats

  • Word: DOC, DOCX, DOCM, DOT, DOTX, DOTM, RTF, TXT
  • Excel: XLS, XLSX, XLSM, XLSB, XLTM, XLTX, XLT, XLAM
  • PowerPoint: PPT, PPTX, PPS, PPSX, ODP, OTP
  • Visio: VSDX, VSDM, VSSX, VSTX, VSTM, VSSM, VSX, VTX, VDX

Documents & images

  • Documents: PDF, XPS, TEX
  • Images: BMP, JPEG, PNG, GIF, TIFF, SVG, PS
  • OpenDocument: ODT, OTT, ODS
  • eBook: EPUB

Other formats

  • Web: HTML, MHTML, MHT
  • Archives: ZIP, TAR, RAR, 7Z, BZ2, GZ
  • OneNote: ONE

GroupDocs.Merger features

Seamlessly merge, split, and manipulate PDF and Office Documents

Feature icon

Combine files

Merge two or more documents into a single document, joining specific pages or page ranges from multiple source documents.

Feature icon

Split document

Utilize the split operation to divide a source document into multiple resultant documents, enabling efficient organization and management of files.

Feature icon

Move pages

Smoothly reposition a page within a document by leveraging the MovePage feature.

Feature icon

Remove pages

Effectively remove individual pages or a collection of specific page numbers from the source document with the RemovePages feature.

Feature icon

Rotate pages

Take advantage of the RotatePages operation to easily rotate pages within a document by specifying the rotation angle as 90, 180, or 270 degrees

Feature icon

Swap pages

Rearrange the page order by exchanging the positions of two pages within the source document, producing a new document.

Feature icon

Extract pages

Generate a new document containing only the selected pages by extracting specific pages or page ranges from the source document.

Feature icon

Change orientation

Modify the page orientation (portrait or landscape) for specific pages or all pages of the document by leveraging the ChangeOrientation operation.

Feature icon

Preview pages

Gain a clearer understanding of the content and structure of the document by generating image representations of its pages. Make previews of all or just specific pages.

Code samples

Some use cases of typical GroupDocs.Merger for Java operations

Merge DOCX files into a single document

With the Merge Word Documents feature you can combine entire DOCX files into a single document by loading the source file, adding more DOCX files to join, and saving the merged document. Below is a Java code snippet demonstrating the merge process:

How to merge DOCX files in Java

// Load the source DOCX file
Merger merger = new Merger("sample1.docx");
// Add another DOCX file to merge
merger.join("sample2.docx");
// Merge DOCX files and save result
merger.save("merged.docx");

Split PDF document into multiple files

Divide a document into multiple files with the Split Document feature to simplify the process of managing and extracting specific sections or pages from large documents. It allows you to divide documents into smaller parts based on various criteria - by page range, by start/end pages, by odd/even page numbers etc.

Split the document to several one-page documents

// Split PDF file using GroupDocs.Merger for Java API
String filePath = "input.pdf";
String filePathOut = "output.pdf";

// Initialize SplitOptions class with output files path format
SplitOptions splitOptions = new SplitOptions(filePathOut, new int[] { 3, 6, 8 });

// Instantiate Merger with input PDF document
Merger merger = new Merger(filePath);

// Call split method and pass SplitOptions object to save resultant documents
merger.split(splitOptions);

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English