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.
If you experience errors, when you try to download a file, make sure your network policies (enforced by your company or ISP) allow downloading ZIP and/or MSI files.

インストール
パッケージは rubygems.org で入手できます。次のコマンドを実行して gem でインストールできます。
gem install groupdocs_viewer_cloud

要件
依存関係
SDK には次の gem が必要です。
| Package | Constraint |
|---|
| addressable | ~> 2.8.0, >= 2.8.0 |
| faraday | ~> 0.14.0 |
クイックスタート
API 認証情報を取得する
GroupDocs.Viewer Cloud を使用するには、GroupDocs.Cloud Dashboard で登録し、Client ID と Client Secret を取得します。
API を初期化する
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)
完全な例は RunExamples.rb を参照してください。
文書を変換してダウンロードする
初期化したら、この基本例を使ってローカル文書をクラウドストレージへアップロードせずに JPG へレンダリングします。
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)
完全な例は ConvertAndDownload.rb を参照してください。
文書をレスポンシブ HTML にレンダリングする
この例はレスポンシブなレイアウトの 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.is_responsive = true
request = GroupDocsViewerCloud::CreateViewRequest.new(viewOptions)
response = apiInstance.create_view(request)
puts("HtmlViewerResponsiveLayout completed: " + response.pages.length.to_s)
完全な例は HtmlViewerResponsiveLayout.rb を参照してください。
選択したページをレンダリングする
この例は文書のページ 2 と 3 を 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)
完全な例は RenderSelectedPages.rb を参照してください。
パスワードで保護された文書を表示する
この例はパスワードで保護された Word 文書を 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)
完全な例は ViewProtectedDocument.rb を参照してください。
対応している表示形式を取得する
API がレンダリングできる文書形式を取得します。
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)
完全な例は GetSupportedFormats.rb を参照してください。
GitHub のサンプル
GroupDocs.Viewer Cloud Ruby Examples リポジトリには、次を扱う実行可能なサンプルが含まれています。
| Category | Examples |
|---|
| Basic Usage | 変換とダウンロード, HTML ビューアー, 画像ビューアー, PDF ビューアー, 文書情報, 添付ファイル, 対応形式 |
| Rendering Options | 選択したページ, 連続するページ, 透かし, ノート, コメント, カスタムフォント |
| Loading Options | パスワードで保護された文書, エンコーディング |
| File Types | アーカイブ, CAD, メール, PDF, スプレッドシート, Visio, Word, Outlook, プロジェクトファイル |
サンプルの実行方法
- サンプルリポジトリ をクローンまたはダウンロードします
Examples/RunExamples.rb を編集し、client_id と client_secret を設定しますExamples ディレクトリに移動しますgem install groupdocs_viewer_cloud を実行しますruby RunExamples.rb を実行します
詳細は Getting Started を参照してください。

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