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_conversion_cloud

Gem Version Gem Total Downloads Ruby-GroupDocsCloud


Requirements

Dependencies

The SDK requires the following gems:

PackageConstraint
addressable~> 2.8.0, >= 2.8.0
faraday~> 1.10
logger~> 1.5

Quick Start

Get your API credentials

To use GroupDocs.Conversion 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.Conversion Cloud SDK for Ruby.

require 'groupdocs_conversion_cloud'

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

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

convert_api = GroupDocsConversionCloud::ConvertApi.from_config(config)

See the full example in RunExamples.rb.

Convert a document (direct, no cloud storage)

Once initialized, use this basic example to convert a local document and receive the result directly.

require 'groupdocs_conversion_cloud'

convert_api = GroupDocsConversionCloud::ConvertApi.from_keys("YourClientId", "YourClientSecret")

file = File.open("four-pages.docx", "r")
request = GroupDocsConversionCloud::ConvertDocumentDirectRequest.new("pdf", file)

result = convert_api.convert_document_direct(request)

puts("Document converted: " + result.length.to_s)

See the full example in ConvertToPdfDirect.rb.

Convert Documents Using Cloud Storage

This example uploads a file to GroupDocs Cloud storage, converts it, and downloads the result.

require 'groupdocs_conversion_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

file_api = GroupDocsConversionCloud::FileApi.from_keys(client_id, client_secret)
convert_api = GroupDocsConversionCloud::ConvertApi.from_keys(client_id, client_secret)

file = File.open("myFile.docx", "r")
file_api.upload_file(GroupDocsConversionCloud::UploadFileRequest.new("myFile.docx", file))

settings = GroupDocsConversionCloud::ConvertSettings.new
settings.file_path = "myFile.docx"
settings.format = "pdf"
settings.output_path = "converted"

result = convert_api.convert_document(GroupDocsConversionCloud::ConvertDocumentRequest.new(settings))

puts("Document converted: " + result[0].url)

response = file_api.download_file(GroupDocsConversionCloud::DownloadFileRequest.new("converted/myFile.pdf", nil))
puts("Downloaded: " + response.length.to_s)

See the SDK README for more details.

Convert Documents Between Various Formats Cloud API

This code converts a password-protected Word document to PDF with output options.

require 'groupdocs_conversion_cloud'

convert_api = GroupDocsConversionCloud::ConvertApi.from_keys("YourClientId", "YourClientSecret")

settings = GroupDocsConversionCloud::ConvertSettings.new
settings.file_path = "WordProcessing/password-protected.docx"
settings.format = "pdf"
settings.output_path = "converted"

load_options = GroupDocsConversionCloud::WordProcessingLoadOptions.new
load_options.password = "password"

convert_options = GroupDocsConversionCloud::PdfConvertOptions.new
convert_options.center_window = true
convert_options.compress_images = false
convert_options.display_doc_title = true
convert_options.dpi = 1024
convert_options.from_page = 1
convert_options.image_quality = 100
convert_options.password = "password"
convert_options.unembed_fonts = true

settings.load_options = load_options
settings.convert_options = convert_options

result = convert_api.convert_document(GroupDocsConversionCloud::ConvertDocumentRequest.new(settings))

puts("Document converted: " + result[0].url)

See the full example in ConvertToPdf.rb.

Convert Specific Pages of a Document Cloud API

This example converts only pages 1 and 3.

require 'groupdocs_conversion_cloud'

convert_api = GroupDocsConversionCloud::ConvertApi.from_keys("YourClientId", "YourClientSecret")

settings = GroupDocsConversionCloud::ConvertSettings.new
settings.file_path = "WordProcessing/four-pages.docx"
settings.format = "pdf"
settings.output_path = "converted/two-pages.pdf"

convert_options = GroupDocsConversionCloud::PdfConvertOptions.new
convert_options.pages = [1, 3]
settings.convert_options = convert_options

result = convert_api.convert_document(GroupDocsConversionCloud::ConvertDocumentRequest.new(settings))

puts("Document converted: " + result[0].url)

See the full example in ConvertSpecificPages.rb.

Get Supported Conversion Formats

Retrieve the supported source-to-target conversions.

require 'groupdocs_conversion_cloud'

info_api = GroupDocsConversionCloud::InfoApi.from_keys("YourClientId", "YourClientSecret")

result = info_api.get_supported_conversion_types(GroupDocsConversionCloud::GetSupportedConversionTypesRequest.new())

puts("Formats count: " + result.length.to_s)

See the full example in GetSupportedConversions.rb.

Examples on GitHub

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

CategoryExamples
ConvertPDF, HTML, image, presentation, spreadsheet, word processing; direct conversion; async conversion
Common OptionsWatermarks, specific pages, consecutive pages, custom fonts
Load OptionsCAD, CSV, email, HTML, OneNote, PDF, presentation, spreadsheet, text, word processing
InfoSupported conversions, document information

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_conversion_cloud
  5. Execute ruby RunExamples.rb

For more details, visit Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


Tags

Document Conversion API | Ruby Cloud API | GroupDocs.Conversion Cloud | REST API | Document Conversion | Auto-detect Formats | Watermarking API | Multi-Format Output | Batch Document Conversion | PDF Conversion | Custom Conversion Options | Page-by-Page Conversion | Font Replacement | OCR Support | Metadata Extraction | Document Merge | Storage API | Document Information API | Document Load Options | Multi-Language Support | Cloud Storage Integration | SDKs for .NET, Java, Ruby | Secure API Access | Docker Support | Scalable Document Conversion | API Rate Limiting



 English