Skip to content

Ruby SDK to communicate with GroupDocs.Viewer Cloud API. View or render Word, Excel, PowerPoint, CAD, Visio, PDF, OpenDocument, email & image formats.

License

Notifications You must be signed in to change notification settings

groupdocs-viewer-cloud/groupdocs-viewer-cloud-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GroupDocs.Viewer Cloud Ruby SDK

Ruby gem for communicating with the GroupDocs.Viewer Cloud API. This SDK allows you to work with GroupDocs.Viewer Cloud REST APIs in your Ruby applications, enabling you to render documents in HTML, image, or PDF format with the flexibility to render the whole document or a custom range of pages.

Requirements

Ruby 2.4+

Installation

Install groupdocs_viewer_cloud from RubyGems:

gem install groupdocs_viewer_cloud

Or add the dependency to your Gemfile and run bundle install:

gem "groupdocs_viewer_cloud", "~> 25.7"

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'groupdocs_viewer_cloud'

# Get your app_sid and app_key at https://dashboard.groupdocs.cloud (free registration is required).
app_sid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
app_key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

# Create instance of the API class
api_instance = GroupDocsViewerCloud::ViewApi.from_keys(app_sid, app_key)

format = "jpg"
file = File.open("myfile.txt", "r")

request = GroupDocsViewerCloud::ConvertAndDownloadRequest.new(format, file)

response = api_instance.convert_and_download(request)

Below is an example demonstrating how to upload a document, render it, and download the result using GroupDocs.Viewer Cloud SDK for Ruby:

require 'groupdocs_viewer_cloud'

app_sid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
app_key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

# Upload input file to cloud storage
file_api_instance = GroupDocsViewerCloud::FileApi.from_keys(app_sid, app_key)
upload_request = GroupDocsViewerCloud::UploadFileRequest.new("myfile.txt", "C:\\Data\\myfile.txt")
file_api_instance.upload_file(upload_request)

# Render to html format
view_api_instance = GroupDocsViewerCloud::ViewApi.from_keys(app_sid, app_key)
view_options = GroupDocsViewerCloud::ViewOptions.new
view_options.file_info = GroupDocsViewerCloud::FileInfo.new
view_options.file_info.file_path = "myfile.txt"
view_options.view_format = "HTML"
view_options.output_path = "myfile.html"

create_view_request = GroupDocsViewerCloud::CreateViewRequest.new(view_options)
view_api_instance.create_view(create_view_request)

# Download result
download_request = GroupDocsViewerCloud::DownloadFileRequest.new("myfile.html")
response = file_api_instance.download_file(download_request)

puts("Expected response type is Stream: #{response.size}")

Licensing

GroupDocs.Viewer Cloud Ruby SDK licensed under MIT License.

Resources

Contact Us

Your feedback is very important to us. Please feel free to contact us

About

Ruby SDK to communicate with GroupDocs.Viewer Cloud API. View or render Word, Excel, PowerPoint, CAD, Visio, PDF, OpenDocument, email & image formats.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 7

Languages