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

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-annotation-cloud

NPM Version NPM Downloads NPM-GroupDocsCloud


Требования

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

Зависимости

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

PackageConstraint
axios1.8.4
form-data*
jsonwebtoken9.0.1
qs6.11.2

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

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

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

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

Используйте следующий код, чтобы начать использовать GroupDocs.Annotation Cloud SDK for Node.js.

"use strict";
const annotation_cloud = require("groupdocs-annotation-cloud");

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

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

const annotateApi = annotation_cloud.AnnotateApi.fromConfig(config);

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

Добавить текстовую аннотацию

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

"use strict";
const annotation_cloud = require("groupdocs-annotation-cloud");

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

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

const annotateApi = annotation_cloud.AnnotateApi.fromConfig(config);

(async () => {
    let a1 = new annotation_cloud.AnnotationInfo();
    a1.annotationPosition = new annotation_cloud.Point();
    a1.annotationPosition.x = 1;
    a1.annotationPosition.y = 1;
    a1.box = new annotation_cloud.Rectangle();
    a1.box.x = 100;
    a1.box.y = 100;
    a1.box.width = 200;
    a1.box.height = 100;
    a1.pageNumber = 0;
    a1.fontColor = 65535;
    a1.fontSize = 12;
    a1.type = annotation_cloud.AnnotationInfo.TypeEnum.TextField;
    a1.text = "Text field text";
    a1.creatorName = "Anonym A.";

    let fileInfo = new annotation_cloud.FileInfo();
    fileInfo.filePath = "annotationdocs\\one-page.docx";
    let options = new annotation_cloud.AnnotateOptions();
    options.fileInfo = fileInfo;
    options.annotations = [a1];
    options.outputPath = "Output/output.docx";
    let result = await annotateApi.annotate(new annotation_cloud.AnnotateRequest(options));
    console.log("AddTextFieldAnnotation: Text Field Annotation added: " + result.href);
})();

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

Добавить аннотацию области

Этот пример добавляет аннотацию области в документ Word.

"use strict";
const annotation_cloud = require("groupdocs-annotation-cloud");

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

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

const annotateApi = annotation_cloud.AnnotateApi.fromConfig(config);

(async () => {
    let a1 = new annotation_cloud.AnnotationInfo();
    a1.annotationPosition = new annotation_cloud.Point();
    a1.annotationPosition.x = 1;
    a1.annotationPosition.y = 1;
    a1.box = new annotation_cloud.Rectangle();
    a1.box.x = 100;
    a1.box.y = 100;
    a1.box.width = 200;
    a1.box.height = 100;
    a1.pageNumber = 0;
    a1.penColor = 1201033;
    a1.penStyle = annotation_cloud.AnnotationInfo.PenStyleEnum.Solid;
    a1.penWidth = 1;
    a1.type = annotation_cloud.AnnotationInfo.TypeEnum.Area;
    a1.text = "This is area annotation";
    a1.creatorName = "Anonym A.";

    let fileInfo = new annotation_cloud.FileInfo();
    fileInfo.filePath = "annotationdocs\\one-page.docx";
    let options = new annotation_cloud.AnnotateOptions();
    options.fileInfo = fileInfo;
    options.annotations = [a1];
    options.outputPath = "Output/output.docx";
    let result = await annotateApi.annotate(new annotation_cloud.AnnotateRequest(options));
    console.log("AddAreaAnnotation: Area Annotation added: " + result.href);
})();

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

Извлечь аннотации

Этот пример возвращает аннотации, сохраненные в документе.

"use strict";
const annotation_cloud = require("groupdocs-annotation-cloud");

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

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

const annotateApi = annotation_cloud.AnnotateApi.fromConfig(config);

(async () => {
    let fileInfo = new annotation_cloud.FileInfo();
    fileInfo.filePath = "input\\input.docx";
    let result = await annotateApi.extract(new annotation_cloud.ExtractRequest(fileInfo));
    console.log("GetAnnotations: annotations count = " + result.length);
})();

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

Удалить аннотации

Этот пример удаляет аннотации 1, 2 и 3 из документа.

"use strict";
const annotation_cloud = require("groupdocs-annotation-cloud");

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

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

const annotateApi = annotation_cloud.AnnotateApi.fromConfig(config);

(async () => {
    let fileInfo = new annotation_cloud.FileInfo();
    fileInfo.filePath = "input\\input.docx";
    let options = new annotation_cloud.RemoveOptions();
    options.fileInfo = fileInfo;
    options.annotationIds = [1, 2, 3];
    options.outputPath = "Output/output.docx";
    let result = await annotateApi.removeAnnotations(new annotation_cloud.RemoveAnnotationsRequest(options));
    console.log("DeleteAnnotations: annotations delete: " + result.href);
})();

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

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

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

"use strict";
const annotation_cloud = require("groupdocs-annotation-cloud");

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

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

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

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

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

Примеры на GitHub

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

CategoryExamples
Add AnnotationТекстовое поле, выделение, подчеркивание, зачеркивание, волнистая линия, замена, скрытие, область, стрелка, расстояние, эллипс, изображение, ссылка, точка, полилиния, водяной знак
Extract and RemoveИзвлечение аннотаций, удаление аннотаций по идентификатору
PreviewПолучение страниц, удаление страниц
Basic 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 Annotation API | Node.js Cloud API | GroupDocs.Annotation Cloud | REST API | Text Annotation | Area Annotation | Highlight Annotation | Remove Annotations | Extract Annotations | Document Information | Cloud Storage Integration | Secure API Access



 Русский