Java SDK as a wrapper for the GroupDocs.Merger Cloud API. Combine documents into one, split document into many in your Java applications.
Start Free TrialGroupDocs.Merger Cloud SDK for Java is a wrapper to communicate with the Cloud API for Java developers. The GroupDocs.Merger Cloud API is a REST service to merge and split documents and supports a wide range of Microsoft Office, OpenDocument, eBook, PDF, text, LaTeX and other document formats. The GroupDocs.Merger Cloud API provides a way to combine two or more documents into one, split any document to many, and generate image representation of any document in PNG, JPG to BMP format. The API offers many other document pages related operations like rotate any page of a PDF document, swap slides of presentations or change page orientation of word documents. The API gives importance to security and allows to apply or remove the password protection to your important business documents.
Using GroupDocs.Merger Cloud API, you can combine two or more documents into one, or split any document into multiple smaller documents. Following few lines of code shows how to combine two word files in Java.
//Get your App SID and App Key at https://dashboard.groupdocs.cloud (free registration is required).
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
DocumentApi apiInstance = new DocumentApi(configuration);
FileInfo fileInfo1 = new FileInfo();
fileInfo1.setFilePath("foldername/doc1.docx");
JoinItem item1 = new JoinItem();
item1.setFileInfo(fileInfo1);
FileInfo fileInfo2 = new FileInfo();
fileInfo2.setFilePath("foldername/doc2.docx");
JoinItem item2 = new JoinItem();
item2.setFileInfo(fileInfo2);
JoinOptions options = new JoinOptions();
options.setJoinItems(Arrays.asList(item1, item2));
options.setOutputPath("output/mergedDoc.docx");
JoinRequest request = new JoinRequest(options);
DocumentResult response = apiInstance.join(request);