浏览我们的产品

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

安装

该软件包在 rubygems.org 可用,可通过执行以下命令使用 gem 安装:

gem install groupdocs_annotation_cloud

Gem Version Gem Total Downloads Ruby-GroupDocsCloud


要求

依赖项

SDK 需要以下 gem:

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

快速入门

获取 API 凭证

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

初始化 API

使用以下代码开始使用 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)

请参阅 RunExamples.rb 中的完整示例。

添加文本域注释

初始化后,使用此基本示例向 Word 文档添加文本域注释。

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)

请参阅 AddTextFieldAnnotation.rb 中的完整示例。

添加区域注释

此示例向 Word 文档添加区域注释。

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)

请参阅 AddAreaAnnotation.rb 中的完整示例。

提取注释

此示例返回文档中保存的注释。

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)

请参阅 ExtractAnnotations.rb 中的完整示例。

删除注释

此示例从文档中删除注释 1, 2 和 3。

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)

请参阅 RemoveAnnotations.rb 中的完整示例。

获取支持的注释格式

获取 API 可以添加注释的文档格式。

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)

请参阅 GetSupportedFormats.rb 中的完整示例。

GitHub 上的示例

GroupDocs.Annotation Cloud Ruby Examples 仓库包含可直接运行的示例,涵盖:

CategoryExamples
Add Annotation文本域, 高亮, 下划线, 删除线, 波浪线, 替换, 涂黑, 区域, 箭头, 距离, 椭圆, 图像, 链接, 点, 折线, 水印
Extract and Remove提取注释, 按 ID 删除注释
Preview获取页面, 删除页面
Basic Usage文档信息, 支持的格式, 文件、文件夹和存储操作

如何运行示例

  1. 克隆或下载示例仓库
  2. 编辑 Examples/RunExamples.rb 并设置 client_id 和 client_secret
  3. 进入 Examples 目录
  4. 运行 gem install groupdocs_annotation_cloud
  5. 执行 ruby RunExamples.rb

更多详情请访问 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



 简体中文