浏览我们的产品

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


要求

依赖项

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



 简体中文