Navegue pelos nossos produtos

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

Instalação

O pacote é disponível no Packagist e pode ser instalado via Composer executando o seguinte comando:

composer require groupdocscloud/groupdocs-annotation-cloud

Packagist Version Packagist Downloads PHP-GroupDocsCloud


Requisitos

  • PHP 8.2 ou posterior
  • Composer
  • Extensões PHP — curl, json, mbstring
  • GroupDocs Credenciais Cloud — Client ID and Client Secret do Dashboard

Dependências

O SDK requer os seguintes pacotes:

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

Início rápido

Obtenha suas credenciais API

Para usar GroupDocs.Annotation Cloud, cadastre-se em GroupDocs.Cloud Dashboard e obtenha seu ID do cliente e Segredo do cliente.

Inicialize o API

Use o código a seguir para começar a usar 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);

Veja o exemplo completo em Utils.php.

Adicione uma anotação de campo de texto

Depois de inicializado, use este exemplo básico para adicionar uma anotação de campo de texto a um documento do Word armazenado no 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";

Veja o exemplo completo em AddTextFieldAnnotation.php.

Adicione uma anotação de área

Este exemplo adiciona uma anotação de área a um documento do 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";

Veja o exemplo completo em AddAreaAnnotation.php.

Remova anotações

Este exemplo remove as anotações 1, 2 e 3 de um 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";

Veja o exemplo completo em DeleteAnnotations.php.

Obtenha formatos de arquivo suportados

Recupere os formatos de anotação suportados.

<?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";
}

Veja o exemplo completo em GetSupportedFormats.php.

Exemplos no GitHub

O repositório GroupDocs.Annotation Cloud PHP Examples inclui exemplos prontos para execução que abrangem:

CategoryExamples
Adicionar anotaçõesCampo de texto, área, seta, distância, elipse, imagem, hiperlink, ponto, polilinha, redação de recursos, ondulado, destaque, substituição, tachado, sublinhado, marca d’água; várias anotações; anotação direta
Gerenciar anotaçõesExtrair anotações, excluir anotações
Visualização do documentoObter páginas, excluir páginas
Uso básicoFormatos suportados, informações do documento
Arquivos, pastas e armazenamentoEnviar, baixar, copiar, mover, excluir; operações de pasta e armazenamento

Como executar os exemplos

  1. Clone ou baixe o repositório de exemplos
  2. Edite Examples/Utils.php e defina seu ClientId e ClientSecret
  3. Vá para o diretório Examples
  4. Execute composer update
  5. Execute php RunExamples.php

Para mais detalhes, visite Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


Tags

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



 Português