Java Cloud SDK to Compare Documents

Integrate document difference checker into your Java applications using REST API. Compare images, documents, eBooks, CAD & PDF files etc.

Start Free Trial

GroupDocs.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.‎‎

Advanced Document Comparison REST API Features

Upload Documents to Cloud Storage and make Comparison

Retrieve Documents of Supported Formats for Comparison as File or Array of Images

Based on Compared Documents Fetch Differences between Both in Resultant Document

Get List of Categories, such as, TypeChanged or OnlyNumbers etc., for the Changed Content

Accept or Reject the Changes to Save or Discard them

Return Updated Changes of the Resultant Document as a Set of Images or their Stream

Fetch Resultant Document (with updated changes) via Stream

Get Document (with the result of comparison) as a Set of Images or their Stream

Retrieve Resultant Document (with the Result of Comparison) as a Stream

Get Changes from Compared Documents

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:‎

Get Changes from Compared Documents 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);

Support and Learning Resources

GroupDocs.Comparison Cloud also offers individual document comparison SDKs for other popular languages as listed below: