AsposeHtml - the Ruby gem for the Aspose.HTML for Cloud API Reference
- API version: 4.0
- Package version: 25.12.1
- Ruby >= 1.9
- libcurl.dll (libcurl.so) (in the ruby /bin directory)
bundle install --jobs 4To build the Ruby code into a gem:
gem build aspose_html_cloud.gemspecThen either install the gem locally:
gem install ./aspose_html_cloud-25.12.1.gem(for development, run gem install --dev ./aspose_html_cloud-25.12.1.gem to install the development dependencies)
or publish the gem to a gem hosting service, e.g. RubyGems.
Finally add this to the Gemfile:
gem 'aspose_html_cloud', '~> 25.12.1'
git clone https://github.com/aspose-html-cloud/aspose-html-cloud-ruby.git
cd aspose-html-cloud-ruby
If the Ruby gem is hosted at a git repository: https://github.com/aspose-html-cloud/aspose-html-cloud-ruby.git, then add the following in the Gemfile:
gem 'aspose_html_cloud', :git => 'https://github.com/aspose-html-cloud/aspose-html-cloud-ruby.git'
Include the Ruby code directly using -I as follows:
ruby -Ilib aspose_html_cloud.rbPossible conversions:
- HTML -> PDF, XPS, DOCX, MD, MHTML, JPEG, BMP, PNG, TIFF, GIF, WEBP
- EPUB -> PDF, XPS, DOCX, JPEG, BMP, PNG, TIFF, GIF, WEBP
- MD -> PDF, XPS, DOCX, HTML, MHTML, JPEG, BMP, PNG, TIFF, GIF, WEBP
- MHTML -> PDF, XPS, DOCX, JPEG, BMP, PNG, TIFF, GIF, WEBP
Please follow the installation procedure and then run the following code:
# Load the gem
require 'aspose_html_cloud'
# Get keys from aspose site.
# There is free quota available.
# For more details, see https://purchase.aspose.cloud/pricing
CONFIG = {
"basePath":"https://api.aspose.cloud/v4.0",
"authPath":"https://api.aspose.cloud/connect/token",
"apiKey":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"appSID":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"debug":true
}
api_instance = AsposeHtml::HtmlApi.new CONFIG
src = "test.html" # String | Document name.
dst = "test.jpg"
opts = {
width: 800, # Double | Resulting image width in pixels. For PDF, XPS and DOCX in inches.
height: 1000, # Double | Resulting image height in pixels. For PDF, XPS and DOCX in inches.
left_margin: 10, # Double | Left resulting image margin in pixels. For PDF, XPS and DOCX in inches.
right_margin: 10, # Double | Right resulting image margin in pixels. For PDF, XPS and DOCX in inches.
top_margin: 20, # Double | Top resulting image margin in pixels. For PDF, XPS and DOCX in inches.
bottom_margin: 20 # Double | Bottom resulting image margin in pixels. For PDF, XPS and DOCX in inches.
}
begin
#Convert the HTML document from the storage by its name to the specified image format.
result = api_instance.convert_local_to_local(src, dst, opts)
p result
rescue AsposeHtml::ApiError => e
puts "Exception when calling HtmlApi->get_convert_document_to_image: #{e}"
endAll URIs are relative to https://api.aspose.cloud/v4.0
| Class | Method | Description |
|---|---|---|
| AsposeHtml::HtmlApi | convert_local_to_local | Convert the HTML or EPUB document from the local file to the local file. |
| AsposeHtml::HtmlApi | convert_local_to_storage | Convert the HTML or EPUB document from the local file to the storage. |
| AsposeHtml::HtmlApi | convert_storage_to_local | Convert the HTML or EPUB document from the storage to the local file. |
| AsposeHtml::HtmlApi | convert_storage_to_storage | Convert the HTML or EPUB document from the storage to the storage. |
| AsposeHtml::HtmlApi | convert_url_to_local | Convert the URL to the local file. |
| AsposeHtml::HtmlApi | convert_url_to_storage | Convert the URL to the storage. |
| AsposeHtml::HtmlApi | convert | General function for conversion. |
- Type: OAuth
- Flow: application
- Authorization URL: "https://api.aspose.cloud/connect/token"
- Scopes: N/A
Tests contain various examples of using the Aspose.HTML SDK.
Docs Documentation for Aspose.HTML Api SDK
Aspose HTML includes Aspose.Storage.Cloud to manipulate files on a remote server. This is used in tests for download test files to the server.
| Class | Method | Description |
|---|---|---|
| AsposeHtml::StorageApi | delete_file | Delete file |
| AsposeHtml::StorageApi | download_file | Download file |
| AsposeHtml::StorageApi | upload_file | Upload file |
| AsposeHtml::StorageApi | create_folder | Create the folder |
| AsposeHtml::StorageApi | delete_folder | Delete folder |
| AsposeHtml::StorageApi | get_files_list | Get all files and folders within a folder |
| AsposeHtml::StorageApi | get_disc_usage | Get disc usage |
| AsposeHtml::StorageApi | object_exists | Check if file or folder exists |
| AsposeHtml::StorageApi | storage_exists | Check if storage exists |
- AsposeHtml::DiscUsage
- AsposeHtml::Error
- AsposeHtml::ErrorDetails
- AsposeHtml::FileVersion
- AsposeHtml::FileVersions
- AsposeHtml::FilesList
- AsposeHtml::FilesUploadResult
- AsposeHtml::ObjectExist
- AsposeHtml::StorageExist
- AsposeHtml::StorageFile
Tests contain various examples of using the Aspose.Storage SDK.
Docs Documentation for Aspose.Storage Api SDK