Browse our Products

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

Installation

The package is available at rubygems.org and it can be installed via gem by executing the following command:

gem install groupdocs_annotation_cloud

Gem Version Gem Total Downloads Ruby-GroupDocsCloud


Requirements

Dependencies

The SDK requires the following gems:

PackageConstraint
addressable~> 2.8.4, >= 2.8.4
faraday~> 0.14.0

Quick Start

Get your API credentials

To use GroupDocs.Annotation Cloud, sign up at GroupDocs.Cloud Dashboard and get your Client ID and Client Secret.

Initialize the API

Use the following code to start using the GroupDocs.Annotation Cloud SDK for Ruby.

require 'groupdocs_annotation_cloud'

# Get your ClientId and ClientSecret at https://dashboard.groupdocs.cloud
client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsAnnotationCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

api = GroupDocsAnnotationCloud::AnnotateApi.from_config(config)

See the full example in RunExamples.rb.

Add a text field annotation

Once initialized, use this basic example to add a text field annotation to a Word document.

require 'groupdocs_annotation_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsAnnotationCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

$api = GroupDocsAnnotationCloud::AnnotateApi.from_config(config)

$a1 = GroupDocsAnnotationCloud::AnnotationInfo.new
$a1.annotation_position = GroupDocsAnnotationCloud::Point.new
$a1.annotation_position.x = 1
$a1.annotation_position.y = 1
$a1.box = GroupDocsAnnotationCloud::Rectangle.new
$a1.box.x = 100
$a1.box.y = 100
$a1.box.width = 200
$a1.box.height = 100
$a1.page_number = 0
$a1.font_color = 1201033
$a1.font_size = 12
$a1.opacity = 0.7
$a1.type = "TextField"
$a1.text = "Text field text"
$a1.creator_name = "Anonym A."

file_info = GroupDocsAnnotationCloud::FileInfo.new()
file_info.file_path = "annotationdocs\\one-page.docx"

options = GroupDocsAnnotationCloud::AnnotateOptions.new()
options.file_info = file_info
options.annotations = [$a1]
options.output_path = "Output/output.docx"

$request = GroupDocsAnnotationCloud::AnnotateRequest.new(options)
result = $api.annotate($request)

puts("AddTextFieldAnnotation: Text Field Annotation added: " + result.href)

See the full example in AddTextFieldAnnotation.rb.

Add an Area Annotation

This example adds an area annotation to a Word document.

require 'groupdocs_annotation_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsAnnotationCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

$api = GroupDocsAnnotationCloud::AnnotateApi.from_config(config)

$a1 = GroupDocsAnnotationCloud::AnnotationInfo.new
$a1.annotation_position = GroupDocsAnnotationCloud::Point.new
$a1.annotation_position.x = 1
$a1.annotation_position.y = 1
$a1.box = GroupDocsAnnotationCloud::Rectangle.new
$a1.box.x = 100
$a1.box.y = 100
$a1.box.width = 200
$a1.box.height = 100
$a1.page_number = 0
$a1.pen_color = 1201033
$a1.pen_style = "Solid"
$a1.pen_width = 1
$a1.opacity = 0.7
$a1.type = "Area"
$a1.text = "This is area annotation"
$a1.creator_name = "Anonym A."

file_info = GroupDocsAnnotationCloud::FileInfo.new()
file_info.file_path = "annotationdocs\\one-page.docx"

options = GroupDocsAnnotationCloud::AnnotateOptions.new()
options.file_info = file_info
options.annotations = [$a1]
options.output_path = "Output/output.docx"

$request = GroupDocsAnnotationCloud::AnnotateRequest.new(options)
result = $api.annotate($request)

puts("AddAreaAnnotation: Area Annotation added: " + result.href)

See the full example in AddAreaAnnotation.rb.

Extract Annotations

This example returns the annotations stored in a document.

require 'groupdocs_annotation_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsAnnotationCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

$api = GroupDocsAnnotationCloud::AnnotateApi.from_config(config)

file_info = GroupDocsAnnotationCloud::FileInfo.new()
file_info.file_path = "annotationdocs\\input.docx"

$request = GroupDocsAnnotationCloud::ExtractRequest.new(file_info)
$response = $api.extract($request)

puts("ExtractAnnotations: annotations count = " + $response.length.to_s)

See the full example in ExtractAnnotations.rb.

Remove Annotations

This example deletes annotations 1, 2, and 3 from a document.

require 'groupdocs_annotation_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsAnnotationCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

$api = GroupDocsAnnotationCloud::AnnotateApi.from_config(config)

file_info = GroupDocsAnnotationCloud::FileInfo.new()
file_info.file_path = "annotationdocs\\input.docx"

options = GroupDocsAnnotationCloud::RemoveOptions.new()
options.file_info = file_info
options.annotation_ids = [1, 2, 3]
options.output_path = "Output/output.docx"

$request = GroupDocsAnnotationCloud::RemoveAnnotationsRequest.new(options)
$response = $api.remove_annotations($request)

puts("RemoveAnnotations: Annotations deleted from document: " + $response.href)

See the full example in RemoveAnnotations.rb.

Get Supported Annotation Formats

Retrieve the document formats the API can annotate.

require 'groupdocs_annotation_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsAnnotationCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

$api = GroupDocsAnnotationCloud::InfoApi.from_config(config)
$response = $api.get_supported_file_formats()

puts("GetSupportedFormats: formats count = " + $response.formats.length.to_s)

See the full example in GetSupportedFormats.rb.

Examples on GitHub

The GroupDocs.Annotation Cloud Ruby Examples repository includes ready-to-run examples covering:

CategoryExamples
Add AnnotationText field, highlight, underline, strikeout, squiggly, replacement, redaction, area, arrow, distance, ellipse, image, link, point, polyline, watermark
Extract and RemoveExtract annotations, remove annotations by id
PreviewGet pages, delete pages
Basic UsageDocument information, supported formats, file, folder, and storage operations

How to run the examples

  1. Clone or download the examples repository
  2. Edit Examples/RunExamples.rb and set your client_id and client_secret
  3. Go to the Examples directory
  4. Run gem install groupdocs_annotation_cloud
  5. Execute ruby RunExamples.rb

For more details, visit Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


Tags

Document Annotation API | Ruby 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



 English