Explore nuestros productos

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

Instalación

El paquete es available en Packagist y se puede instalar a través de Composer ejecutando el siguiente comando:

composer require groupdocscloud/groupdocs-annotation-cloud

Packagist Version Packagist Downloads PHP-GroupDocsCloud


Requisitos

  • PHP 8.2 o posterior
  • Composer
  • Extensiones de PHP — curl, json, mbstring
  • Credenciales de nube de GroupDocs — Client ID and Client Secret desde el tablero

Dependencias

El SDK requiere los siguientes paquetes:

PackageConstraint
guzzlehttp/guzzle^6.5.8 or ^7.4.5
ext-curl*
ext-json*
ext-mbstring*

Inicio rápido

Obtenga sus credenciales API

Para utilizar GroupDocs.Annotation Cloud, regístrese en GroupDocs.Cloud Dashboard y obtenga su ID de cliente y su Secreto de cliente.

Inicializar la API

Utilice el siguiente código para comenzar a utilizar GroupDocs.Annotation Cloud SDK para PHP:

<?php

require_once(__DIR__ . '/vendor/autoload.php');

// Get your ClientId and ClientSecret at https://dashboard.groupdocs.cloud
$configuration = new GroupDocs\Annotation\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");

$annotateApi = new GroupDocs\Annotation\AnnotateApi($configuration);

Consulte el ejemplo completo en Utils.php.

Agregar una anotación de campo de texto

Una vez inicializado, utilice este ejemplo básico para agregar una anotación de campo de texto a un documento de Word almacenado en GroupDocs Cloud.

<?php

require_once(__DIR__ . '/vendor/autoload.php');

use GroupDocs\Annotation\Model;
use GroupDocs\Annotation\Model\Requests;

$configuration = new GroupDocs\Annotation\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");

$annotateApi = new GroupDocs\Annotation\AnnotateApi($configuration);

$a = new Model\AnnotationInfo();
$pt = new Model\Point();
$pt->setX(1);
$pt->setY(1);
$a->setAnnotationPosition($pt);
$box = new Model\Rectangle();
$box->setX(100);
$box->setY(100);
$box->setWidth(200);
$box->setHeight(100);
$a->setBox($box);
$a->setPageNumber(0);
$a->setFontColor(1201033);
$a->setFontSize(12);
$a->setOpacity(0.7);
$a->setType(Model\AnnotationInfo::TYPE_TEXT_FIELD);
$a->setText("Text field text");
$a->setCreatorName("Anonym A.");

$fileInfo = new Model\FileInfo();
$fileInfo->setFilePath("annotationdocs\\one-page.docx");

$options = new Model\AnnotateOptions();
$options->setFileInfo($fileInfo);
$options->setAnnotations([$a]);
$options->setOutputPath("Output\\output.docx");

$request = new Requests\annotateRequest($options);
$result = $annotateApi->annotate($request);

echo "Text field annotation added: " . $result->getHref() . "\n";

Consulte el ejemplo completo en AddTextFieldAnnotation.php.

Agregar una anotación de área

Este ejemplo agrega una anotación de área a un documento de Word.

<?php

require_once(__DIR__ . '/vendor/autoload.php');

use GroupDocs\Annotation\Model;
use GroupDocs\Annotation\Model\Requests;

$configuration = new GroupDocs\Annotation\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");

$annotateApi = new GroupDocs\Annotation\AnnotateApi($configuration);

$a = new Model\AnnotationInfo();
$pt = new Model\Point();
$pt->setX(1);
$pt->setY(1);
$a->setAnnotationPosition($pt);
$box = new Model\Rectangle();
$box->setX(100);
$box->setY(100);
$box->setWidth(200);
$box->setHeight(100);
$a->setBox($box);
$a->setPageNumber(0);
$a->setPenColor(1201033);
$a->setPenStyle(Model\AnnotationInfo::PEN_STYLE_SOLID);
$a->setPenWidth(1);
$a->setOpacity(0.7);
$a->setType(Model\AnnotationInfo::TYPE_AREA);
$a->setText("This is area annotation");
$a->setCreatorName("Anonym A.");

$fileInfo = new Model\FileInfo();
$fileInfo->setFilePath("annotationdocs\\one-page.docx");

$options = new Model\AnnotateOptions();
$options->setFileInfo($fileInfo);
$options->setAnnotations([$a]);
$options->setOutputPath("Output\\output.docx");

$request = new Requests\annotateRequest($options);
$result = $annotateApi->annotate($request);

echo "Area annotation added: " . $result->getHref() . "\n";

Consulte el ejemplo completo en AddAreaAnnotation.php.

Eliminar anotaciones

Este ejemplo elimina las anotaciones 1, 2 y 3 de un documento.

<?php

require_once(__DIR__ . '/vendor/autoload.php');

use GroupDocs\Annotation\Model;
use GroupDocs\Annotation\Model\Requests;

$configuration = new GroupDocs\Annotation\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");

$annotateApi = new GroupDocs\Annotation\AnnotateApi($configuration);

$fileInfo = new Model\FileInfo();
$fileInfo->setFilePath("input\\input.docx");

$options = new Model\RemoveOptions();
$options->setFileInfo($fileInfo);
$options->setAnnotationIds([1, 2, 3]);
$options->setOutputPath("Output\\output.docx");

$request = new Requests\removeAnnotationsRequest($options);
$result = $annotateApi->removeAnnotations($request);

echo "Annotations deleted: " . $result->getHref() . "\n";

Consulte el ejemplo completo en DeleteAnnotations.php.

Obtenga formatos de archivo compatibles

Recupere los formatos de anotación compatibles.

<?php

require_once(__DIR__ . '/vendor/autoload.php');

$configuration = new GroupDocs\Annotation\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");

$infoApi = new GroupDocs\Annotation\InfoApi($configuration);

$response = $infoApi->getSupportedFileFormats();

foreach ($response->getFormats() as $format) {
    echo $format->getFileFormat() . " - " . $format->getExtension() . "\n";
}

Consulte el ejemplo completo en GetSupportedFormats.php.

Ejemplos en GitHub

El GroupDocs.Annotation Cloud PHP Examples El repositorio incluye ejemplos listos para ejecutar que cubren:

CategoríaEjemplos
Agregar anotacionesCampo de texto, área, flecha, distancia, elipse, imagen, enlace, punto, polilínea, redacción de recursos, ondulado, resaltado, reemplazo, tachado, subrayado, marca de agua; anotaciones múltiples; anotación directa
Administrar anotacionesExtraer anotaciones, eliminar anotaciones
Vista previa del documentoObtener páginas, eliminar páginas
Uso básicoFormatos admitidos, información del documento
Archivos, carpetas y almacenamientoCargar, descargar, copiar, mover, eliminar; operaciones de carpetas y almacenamiento

Cómo ejecutar los ejemplos

  1. Clona o descarga el repositorio de ejemplos
  2. Editar Examples/Utils.php y configura tu ClientId y ClientSecret
  3. Ve al Examples directorio
  4. correr composer update
  5. Ejecutar php RunExamples.php

Para más detalles, visite Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


Etiquetas

Document Annotation API | PHP Cloud API | GroupDocs.Annotation Cloud | REST API | Text Field Annotation | Area Annotation | Remove Annotations | Highlight Annotation | Redaction | PDF Annotation | Word Annotation | Supported File Formats | Document Information | Cloud Storage | Secure API Access


 Español