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 está disponible en rubygems.org y se puede instalar mediante gem ejecutando el siguiente comando:

gem install groupdocs_viewer_cloud

Gem Version Gem Total Downloads Ruby-GroupDocsCloud


Requisitos

Dependencias

El SDK requiere las siguientes gemas:

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

Inicio rápido

Obtenga sus credenciales de API

Para usar GroupDocs.Viewer Cloud, regístrese en el GroupDocs.Cloud Dashboard y obtenga su Client ID y Client Secret.

Inicialice la API

Utilice el siguiente código para empezar a usar el GroupDocs.Viewer Cloud SDK for Ruby.

require 'groupdocs_viewer_cloud'

# Get your client id and client secret at https://dashboard.groupdocs.cloud
client_id = "YourClientId"
client_secret = "YourClientSecret"

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

apiInstance = GroupDocsViewerCloud::ViewApi.from_config(config)

Vea el ejemplo completo en RunExamples.rb.

Convierta y descargue un documento

Una vez inicializado, use este ejemplo básico para representar un documento local como JPG sin cargarlo en el almacenamiento en la nube.

require 'groupdocs_viewer_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

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

apiInstance = GroupDocsViewerCloud::ViewApi.from_config(config)

format = "jpg"
file = File.open("Resources/SampleFiles/sample.docx", "r")
request = GroupDocsViewerCloud::ConvertAndDownloadRequest.new format, file
response = apiInstance.convert_and_download(request)

puts("ConvertAndDownload completed: " + response.length.to_s)

Vea el ejemplo completo en ConvertAndDownload.rb.

Represente un documento como HTML adaptable

Este ejemplo crea una vista HTML con un diseño adaptable.

require 'groupdocs_viewer_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

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

apiInstance = GroupDocsViewerCloud::ViewApi.from_config(config)
viewOptions = GroupDocsViewerCloud::ViewOptions.new
viewOptions.file_info = GroupDocsViewerCloud::FileInfo.new
viewOptions.file_info.file_path = "SampleFiles/sample.docx"
viewOptions.view_format = "HTML"
viewOptions.render_options = GroupDocsViewerCloud::HtmlOptions.new
viewOptions.render_options.is_responsive = true

request = GroupDocsViewerCloud::CreateViewRequest.new(viewOptions)
response = apiInstance.create_view(request)

puts("HtmlViewerResponsiveLayout completed: " + response.pages.length.to_s)

Vea el ejemplo completo en HtmlViewerResponsiveLayout.rb.

Represente las páginas seleccionadas

Este ejemplo representa las páginas 2 y 3 de un documento como HTML.

require 'groupdocs_viewer_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

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

apiInstance = GroupDocsViewerCloud::ViewApi.from_config(config)
viewOptions = GroupDocsViewerCloud::ViewOptions.new
viewOptions.file_info = GroupDocsViewerCloud::FileInfo.new
viewOptions.file_info.file_path = "SampleFiles/sample.docx"
viewOptions.view_format = "HTML"
viewOptions.render_options = GroupDocsViewerCloud::HtmlOptions.new
viewOptions.render_options.pages_to_render = [2, 3]

request = GroupDocsViewerCloud::CreateViewRequest.new(viewOptions)
response = apiInstance.create_view(request)

puts("RenderSelectedPages completed: " + response.pages.length.to_s)

Vea el ejemplo completo en RenderSelectedPages.rb.

Vea un documento protegido con contraseña

Este ejemplo representa un documento de Word protegido con contraseña como HTML.

require 'groupdocs_viewer_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

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

apiInstance = GroupDocsViewerCloud::ViewApi.from_config(config)
viewOptions = GroupDocsViewerCloud::ViewOptions.new
viewOptions.file_info = GroupDocsViewerCloud::FileInfo.new
viewOptions.file_info.file_path = "SampleFiles/password_protected.docx"
viewOptions.file_info.password = "12345"
viewOptions.view_format = "HTML"

request = GroupDocsViewerCloud::CreateViewRequest.new(viewOptions)
response = apiInstance.create_view(request)

puts("ViewProtectedDocument completed: " + response.pages.length.to_s)

Vea el ejemplo completo en ViewProtectedDocument.rb.

Obtenga los formatos de Viewer compatibles

Recupere los formatos de documento que la API puede representar.

require 'groupdocs_viewer_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

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

infoApi = GroupDocsViewerCloud::InfoApi.from_config(config)
result = infoApi.get_supported_file_formats()
puts("Formats count: " + result.formats.length.to_s)

Vea el ejemplo completo en GetSupportedFormats.rb.

Ejemplos en GitHub

El repositorio GroupDocs.Viewer Cloud Ruby Examples incluye ejemplos listos para ejecutar que cubren:

CategoryExamples
Basic UsageConvertir y descargar, visor HTML, visor de imágenes, visor PDF, información del documento, archivos adjuntos, formatos compatibles
Rendering OptionsPáginas seleccionadas, páginas consecutivas, marcas de agua, notas, comentarios, fuentes personalizadas
Loading OptionsDocumentos protegidos con contraseña, codificación
File TypesArchivos de almacenamiento, CAD, correo, PDF, hojas de cálculo, Visio, Word, Outlook y proyectos

Cómo ejecutar los ejemplos

  1. Clone o descargue el repositorio de ejemplos
  2. Edite Examples/RunExamples.rb y establezca client_id y client_secret
  3. Vaya al directorio Examples
  4. Ejecute gem install groupdocs_viewer_cloud
  5. Ejecute ruby RunExamples.rb

Para obtener más detalles, visite Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


Tags

Document Rendering API | Ruby Cloud API | GroupDocs.Viewer Cloud | REST API | HTML Rendering | PDF Conversion | Image Rendering | Document Viewing | Multi-Page Rendering | Document Streaming | CAD Rendering | E-Mail Message Rendering | Visio Rendering | MS Project Rendering | Outlook Data Rendering | Spreadsheet Rendering | Word Processing Rendering | Custom View Options | Responsive HTML | Attachment Rendering | Secure API Access | Cloud Storage Integration



 Español