Browse our Products

If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.


Product Docs Swagger Examples Blog Support Dashboard

Installation

The package is available at npmjs.com and it can be installed via npm by executing the following command:

npm install groupdocs-comparison-cloud

NPM Version NPM Downloads NPM-GroupDocsCloud


Requirements

Dependencies

The SDK requires the following packages:

PackageConstraint
axios^1.16.1
form-data*
jsonwebtoken9.0.1
qs6.15.2

Quick Start

Get your API credentials

To use GroupDocs.Comparison Cloud, sign up at GroupDocs.Cloud Dashboard and get your Client ID and Client Secret.

Initialize the API

Use the following code to start using the GroupDocs.Comparison Cloud SDK for Node.js.

"use strict";
const comparison_cloud = require("groupdocs-comparison-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new comparison_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const compareApi = comparison_cloud.CompareApi.fromConfig(config);

See the full example in RunExamples.js.

Compare two documents

Once initialized, use this basic example to compare two Word documents and save the result.

"use strict";
const comparison_cloud = require("groupdocs-comparison-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new comparison_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const compareApi = comparison_cloud.CompareApi.fromConfig(config);

(async () => {
    let source = new comparison_cloud.FileInfo();
    source.filePath = "source_files/word/source.docx";
    let target = new comparison_cloud.FileInfo();
    target.filePath = "target_files/word/target.docx";
    let options = new comparison_cloud.ComparisonOptions();
    options.sourceFile = source;
    options.targetFiles = [target];
    options.outputPath = "output/result.docx";

    let request = new comparison_cloud.ComparisonsRequest(options);
    let response = await compareApi.comparisons(request);
    console.log("Output file link: " + response.href);
})();

See the full example in CompareDocuments.js.

Get the List of Changes

This example returns the changes between two Word documents.

"use strict";
const comparison_cloud = require("groupdocs-comparison-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new comparison_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const compareApi = comparison_cloud.CompareApi.fromConfig(config);

(async () => {
    let source = new comparison_cloud.FileInfo();
    source.filePath = "source_files/word/source.docx";
    let target = new comparison_cloud.FileInfo();
    target.filePath = "target_files/word/target.docx";
    let options = new comparison_cloud.ComparisonOptions();
    options.sourceFile = source;
    options.targetFiles = [target];
    options.outputPath = "output/result.docx";

    let request = new comparison_cloud.PostChangesRequest(options);
    let changes = await compareApi.postChanges(request);
    console.log("Changes count: " + changes.length);
})();

See the full example in GetListOfChanges.js.

Get Document Information

This example returns the page count of a source document.

"use strict";
const comparison_cloud = require("groupdocs-comparison-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new comparison_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const infoApi = comparison_cloud.InfoApi.fromConfig(config);

(async () => {
    let fileInfo = new comparison_cloud.FileInfo();
    fileInfo.filePath = "source_files/word/source.docx";
    let request = new comparison_cloud.GetDocumentInfoRequest(fileInfo);
    let response = await infoApi.getDocumentInfo(request);
    console.log("GetDocumentInformation completed: " + response.pageCount);
})();

See the full example in GetDocumentInformation.js.

Get Supported Comparison Formats

Retrieve the document formats the API can compare.

"use strict";
const comparison_cloud = require("groupdocs-comparison-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new comparison_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const infoApi = comparison_cloud.InfoApi.fromConfig(config);

(async () => {
    let response = await infoApi.getSupportedFileFormats();
    console.log("Formats count: " + response.formats.length);
})();

See the full example in GetSupportedFormats.js.

Examples on GitHub

The GroupDocs.Comparison Cloud Node.js Examples repository includes ready-to-run examples covering:

CategoryExamples
Basic UsageCompare documents, compare PDF documents, document information, supported formats, preview, license consumption
Advanced UsageMultiple documents, protected documents, sensitivity, change styles, list of changes, revisions, save options

How to run the examples

  1. Clone or download the examples repository
  2. Edit Examples/RunExamples.js and set your clientId and clientSecret
  3. Go to the Examples directory
  4. Run npm install
  5. Run npm update
  6. Execute npm run-script start

For more details, visit Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


Tags

Document Comparison API | Node.js Cloud API | GroupDocs.Comparison Cloud | REST API | Document Comparison | Folder Comparison | Revision Control | Track Changes | Preview Generation | Multi-format Support | Password Protected Documents | Source Code Comparison | Change Tracking | Customization | Document Merging | Change Coordinates | Metadata Extraction | Document Security | Document Review | Secure API Access | Cloud Storage Integration | Cross-platform API



 English