浏览我们的产品

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.


Docs Swagger Examples Blog Support Dashboard

安装

该软件包在 npmjs.com 可用,可通过执行以下命令使用 npm 安装:

npm install groupdocs-metadata-cloud

NPM Version NPM Downloads NPM-GroupDocsCloud


要求

依赖项

SDK 需要以下包:

PackageConstraint
axios1.13.3
form-data*
jsonwebtoken9.0.1
qs6.14.1

快速入门

获取 API 凭证

要使用 GroupDocs.Metadata Cloud,请在 GroupDocs.Cloud Dashboard 注册并获取 Client ID 和 Client Secret。

初始化 API

使用以下代码开始使用 GroupDocs.Metadata Cloud SDK for Node.js。构造函数先接收 Client ID,然后接收 Client Secret。

"use strict";
const metadata_cloud = require("groupdocs-metadata-cloud");

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

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

const metadataApi = metadata_cloud.MetadataApi.fromConfig(config);

详情请参阅 test_context.ts。

提取元数据

初始化后,使用此基本示例提取云存储中 Word 文档的元数据树。

"use strict";
const metadata_cloud = require("groupdocs-metadata-cloud");

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

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

const metadataApi = metadata_cloud.MetadataApi.fromConfig(config);

const extractOptions = new metadata_cloud.ExtractOptions();
extractOptions.fileInfo = new metadata_cloud.FileInfo();
extractOptions.fileInfo.filePath = "documents/input.docx";
const request = new metadata_cloud.ExtractRequest(extractOptions);

metadataApi.extract(request).then((result) => {
    console.log(result.metadataTree.innerPackages.length);
});

详情请参阅 test_metadata_extract_api.ts。

设置元数据属性

此示例替换 Word 文档的 Creator 属性。

"use strict";
const metadata_cloud = require("groupdocs-metadata-cloud");

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

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

const metadataApi = metadata_cloud.MetadataApi.fromConfig(config);

const options = new metadata_cloud.SetOptions({
    fileInfo: new metadata_cloud.FileInfo(),
    properties: [
        new metadata_cloud.SetProperty({
            newValue: "NewAuthor",
            type: "String",
            searchCriteria: new metadata_cloud.SearchCriteria({
                tagOptions: new metadata_cloud.TagOptions({
                    exactTag: new metadata_cloud.Tag({
                        name: "Creator",
                        category: "Person"
                    })
                })
            })
        })
    ]
});
options.fileInfo.filePath = "documents/input.docx";
const request = new metadata_cloud.SetRequest(options);

metadataApi.set(request).then((result) => {
    console.log(result.setCount);
});

详情请参阅 test_metadata_set_api.ts。

按标签删除元数据

此示例从 Word 文档中删除 Title 属性。

"use strict";
const metadata_cloud = require("groupdocs-metadata-cloud");

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

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

const metadataApi = metadata_cloud.MetadataApi.fromConfig(config);

const options = new metadata_cloud.RemoveOptions({
    fileInfo: new metadata_cloud.FileInfo(),
    searchCriteria: new metadata_cloud.SearchCriteria({
        tagOptions: new metadata_cloud.TagOptions({
            exactTag: new metadata_cloud.Tag({
                name: "Title",
                category: "Content"
            })
        })
    })
});
options.fileInfo.filePath = "documents/input.docx";
const request = new metadata_cloud.RemoveRequest(options);

metadataApi.remove(request).then((result) => {
    console.log(result.removedCount);
});

详情请参阅 test_metadata_remove_api.ts。

获取文档信息

此示例读取演示文稿的文件格式和页数。

"use strict";
const metadata_cloud = require("groupdocs-metadata-cloud");

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

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

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

const infoOptions = new metadata_cloud.InfoOptions();
infoOptions.fileInfo = new metadata_cloud.FileInfo();
infoOptions.fileInfo.filePath = "documents/input.pptx";
const request = new metadata_cloud.GetInfoRequest(infoOptions);

infoApi.getInfo(request).then((result) => {
    console.log(result.pageCount);
});

详情请参阅 test_metadata_info_api.ts。

获取支持的元数据格式

获取 API 可以读取的文件格式。

"use strict";
const metadata_cloud = require("groupdocs-metadata-cloud");

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

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

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

infoApi.getSupportedFileFormats().then((result) => {
    result.formats.forEach(function (format) {
        console.log(format.fileFormat);
    });
});

详情请参阅 test_formats_api.ts。

GitHub 上的示例

GroupDocs.Metadata Cloud Node.js SDK 仓库包含 SDK 和测试,涵盖:

CategoryExamples
Metadata提取、添加、设置和删除元数据, 按标签或属性名搜索
Info文档信息和支持的文件格式
Storage文件、文件夹和存储操作

如何运行示例

  1. 克隆或下载 SDK 仓库
  2. 编辑 test/test_settings.json 并设置 AppSid 和 AppKey
  3. 运行 npm install
  4. 测试位于 test/api/
  5. 执行 npm test

更多详情请访问 Getting Started。


Docs Swagger Examples Blog Support Dashboard


Tags

Document Metadata API | Node.js Cloud API | GroupDocs.Metadata Cloud | REST API | Metadata Extraction | Metadata Management | Metadata Filtering | Metadata Searching | Metadata Preservation | Cloud Storage Integration | File Management | Folder Management | File Versioning | Secure API Access | Cross-Platform API | PDF Metadata | Image Metadata | Video Metadata | Audio Metadata | Document Metadata Editing | MIT License



 简体中文