Easily open Word, PDF documents with just a few lines of Ruby code. Our Ruby library will provide you with everything you need to access document content programmatically.
If you want to open a text file and work with the data in plain-text format, you can do it using the most basic features of the Ruby language and operating system. As for reading office documents, presented in a wide variety of file formats (DOCX, DOC, PDF, RTF, ODT, HTML, etc.), this task is more difficult to solve, since such documents are described by complex tree-like data structures within the DOM model.
Our Ruby library is a cloud-based solution that will allow you to open documents in any office and web format. This distributed approach gives you flexibility in software development using Ruby language, as all resource-intensive document processing will take place on Aspose servers. All you need is to get private keys to access Cloud API in Ruby code.
You can iterate over document elements, or you can search for specific elements in the DOM tree. We provide a wide range of Ruby functions both for working with the structure of the document and with the data contained in the document nodes.
The following Ruby code example will help you quickly figure out how to load a document and perform some actions on it.
require 'aspose_words_cloud'
AsposeWordsCloud.configure do |config|
config.client_data['ClientId'] = '####-####-####-####-####'
config.client_data['ClientSecret'] = '##################'
end
@words_api = WordsAPI.new
file_name= 'Input.docx'
request_file_content = File.open(File.read(file_name))
upload_document_request = UploadFileRequest.new(
file_content: request_file_content, path: file_name)
@words_api.upload_file(upload_document_request)
request_paragraph = ParagraphInsert.new(
{:Text => 'Reading and writing to the file in the cloud occurs automatically.'})
insert_paragraph_request = InsertParagraphRequest.new(
name: file_name, paragraph: request_paragraph)
@words_api.insert_paragraph(insert_paragraph_request)
download_document_request = DownloadFileRequest.new(path: file_name)
@words_api.download_file(download_document_request)
Install Aspose.Words Cloud SDK for Ruby using RubyGems hosting service. Run gem install aspose_words_cloud to install the package. As an alternative, you can manually clone Aspose.Words Cloud SDK for Ruby source code from GitHub and use it in your project. Please follow these Instructions to quickly get the necessary security credentials and access our REST API.