Integrate document difference checker into your Java applications using REST API. Compare images, documents, eBooks, CAD & PDF files etc.
Start Free TrialGroupDocs.Comparison for Cloud is a REST API that enables your Java applications to compare two same format documents to find differences between them make a resultant file and allow you to accept or reject the retrieved changes. Our Document Comparison SDK for Java allows easy integration into your existing applications, so that your end-users can compare documents, spreadsheets, presentations, Microsoft Visio diagrams, emails, and files of many other formats.
Using GroupDocs.Comparison Cloud API, you can compare documents and get the list of changes between them. Following piece of code shows how you can retrieve difference between a source and a target DOCX files and fetch their differences in a result.DOCX file using Java:
# TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud/#/apps (free registration is required).
# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-java
String outPath = "result.docx",
sourceName = "source.docx",
targetName = "target.docx";
StorageApi storageApi = Utils.getStorageApiInstance();
// Upload files to Cloud Storage
File file = new File("src/main/resources/" + sourceName);
ResponseMessage storageresponse = storageApi.PutCreate("comparison/" + sourceName, null, null, file);
file = new File("src/main/resources/" + targetName);
storageresponse = storageApi.PutCreate("comparison/" + targetName, null, null, file);
ChangesApi changesApi = Utils.getChangesApiInstance();
PutChangesDocumentRequest request = new PutChangesDocumentRequest();
request.setRequest(GetComparisonRequest(sourceName, targetName));
request.setOutPath(outPath);
Link response = changesApi.putChangesDocument(request);
System.out.println(response);