Просмотрите наши продукты

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

Установка

Пакет доступен на npmjs.com и может быть установлен через npm следующей командой:

npm install groupdocs-comparison-cloud

NPM Version NPM Downloads NPM-GroupDocsCloud


Требования

  • Node.js 4.8 или новее
  • npm
  • Учетные данные GroupDocs Cloud — Client ID and Client Secret из панели управления

Зависимости

SDK требует следующие пакеты:

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

Быстрый старт

Получите учетные данные API

Чтобы использовать GroupDocs.Comparison Cloud, зарегистрируйтесь на GroupDocs.Cloud Dashboard и получите Client ID и Client Secret.

Инициализируйте API

Используйте следующий код, чтобы начать использовать 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);

Полный пример см. в RunExamples.js.

Сравнить два документа

После инициализации используйте этот базовый пример, чтобы сравнить два документа Word и сохранить результат.

"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);
})();

Полный пример см. в CompareDocuments.js.

Получить список изменений

Этот пример возвращает изменения между двумя документами Word.

"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);
})();

Полный пример см. в GetListOfChanges.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 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);
})();

Полный пример см. в GetDocumentInformation.js.

Получить поддерживаемые форматы сравнения

Получите форматы документов, которые API может сравнивать.

"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);
})();

Полный пример см. в GetSupportedFormats.js.

Примеры на GitHub

Репозиторий GroupDocs.Comparison Cloud Node.js Examples содержит готовые к запуску примеры:

CategoryExamples
Basic UsageСравнение документов, сравнение документов PDF, сведения о документе, поддерживаемые форматы, предварительный просмотр, расход лицензии
Advanced UsageНесколько документов, защищенные документы, чувствительность, стили изменений, список изменений, редакции, параметры сохранения

Как запустить примеры

  1. Клонируйте или скачайте репозиторий примеров
  2. Отредактируйте Examples/RunExamples.js и задайте clientId и clientSecret
  3. Перейдите в каталог Examples
  4. Выполните npm install
  5. Выполните npm update
  6. Выполните npm run-script start

Подробности см. в разделе 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



 Русский