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.

インストール
パッケージは、availablePyPI にあり、経由でインストールできますpip次のコマンドを実行します。
pip install groupdocs-viewer-cloud

要件
依存関係
SDK は次のパッケージを自動的にインストールします。
| パッケージ | 制約 |
|---|
| urllib3 | >= 1.15 |
| six | >= 1.10 |
| certifi | — |
| python-dateutil | — |
クイックスタート
API 認証情報を取得する
GroupDocs.Viewer Cloud を使用するには、次の URL でサインアップしてください。GroupDocs.Cloud Dashboardクライアント ID と クライアント シークレット を取得します。
API を初期化する
GroupDocs.Viewer Cloud SDK for Python の使用を開始するには、次のコードを使用します。
import groupdocs_viewer_cloud
# Get your ClientId and ClientSecret at https://dashboard.groupdocs.cloud
client_id = "YourClientId"
client_secret = "YourClientSecret"
# Create API configuration
configuration = groupdocs_viewer_cloud.Configuration(client_id, client_secret)
configuration.api_base_url = "https://api.groupdocs.cloud"
# Create instance of the View API
view_api = groupdocs_viewer_cloud.ViewApi.from_config(configuration)
ドキュメントを HTML にレンダリングする
初期化したら、次の基本的な例を使用してクラウド ストレージからドキュメントをレンダリングします。
import groupdocs_viewer_cloud
client_id = "YourClientId"
client_secret = "YourClientSecret"
view_api = groupdocs_viewer_cloud.ViewApi.from_keys(client_id, client_secret)
view_options = groupdocs_viewer_cloud.ViewOptions()
view_options.file_info = groupdocs_viewer_cloud.FileInfo()
view_options.file_info.file_path = "SampleFiles/sample.docx"
view_options.view_format = "HTML"
request = groupdocs_viewer_cloud.CreateViewRequest(view_options)
response = view_api.create_view(request)
print("Document rendered: " + str(len(response.pages)) + " pages")
このクイック スタート ガイドを使用すると、Python アプリケーションで GroupDocs.Viewer Cloud を使用してドキュメントのレンダリングを開始する準備が整います。詳細については、次のサイトを参照してください。documentation.
サポートされているファイル形式を取得する
Viewer API を通じて利用できる、サポートされているファイル形式の完全なリストを取得します。
import groupdocs_viewer_cloud
info_api = groupdocs_viewer_cloud.InfoApi.from_keys("YourClientId", "YourClientSecret")
try:
response = info_api.get_supported_file_formats()
print("Supported file-formats:")
for fmt in response.formats:
print("{0} ({1})".format(fmt.file_format, fmt.extension))
except groupdocs_viewer_cloud.ApiException as e:
print("Exception when calling get_supported_file_formats: {0}".format(e.message))
ドキュメントを PDF としてレンダリングする
この例では、GroupDocs.Viewer Cloud API を使用して Word ドキュメントを PDF 形式にレンダリングする方法を示します。
import groupdocs_viewer_cloud
view_api = groupdocs_viewer_cloud.ViewApi.from_keys("YourClientId", "YourClientSecret")
view_options = groupdocs_viewer_cloud.ViewOptions()
view_options.file_info = groupdocs_viewer_cloud.FileInfo()
view_options.file_info.file_path = "SampleFiles/sample.docx"
view_options.view_format = "PDF"
view_options.render_options = groupdocs_viewer_cloud.PdfOptions()
request = groupdocs_viewer_cloud.CreateViewRequest(view_options)
response = view_api.create_view(request)
print("Document rendered to PDF: " + response.file.path)
スプレッドシートを HTML としてレンダリングする
このコード サンプルは、GroupDocs.Viewer Cloud API を使用して Excel スプレッドシートを HTML に変換します。
import groupdocs_viewer_cloud
view_api = groupdocs_viewer_cloud.ViewApi.from_keys("YourClientId", "YourClientSecret")
view_options = groupdocs_viewer_cloud.ViewOptions()
view_options.file_info = groupdocs_viewer_cloud.FileInfo()
view_options.file_info.file_path = "SampleFiles/sample.xlsx"
view_options.view_format = "HTML"
view_options.render_options = groupdocs_viewer_cloud.HtmlOptions()
request = groupdocs_viewer_cloud.CreateViewRequest(view_options)
response = view_api.create_view(request)
print("Spreadsheet rendered to HTML: " + str(len(response.pages)) + " pages")
レスポンシブ HTML レイアウトでドキュメントをレンダリングする
さまざまな画面サイズやデバイスに適応するレスポンシブ HTML としてドキュメントをレンダリングします。
import groupdocs_viewer_cloud
view_api = groupdocs_viewer_cloud.ViewApi.from_keys("YourClientId", "YourClientSecret")
view_options = groupdocs_viewer_cloud.ViewOptions()
view_options.file_info = groupdocs_viewer_cloud.FileInfo()
view_options.file_info.file_path = "SampleFiles/sample.docx"
view_options.view_format = "HTML"
view_options.render_options = groupdocs_viewer_cloud.HtmlOptions()
view_options.render_options.is_responsive = True
request = groupdocs_viewer_cloud.CreateViewRequest(view_options)
response = view_api.create_view(request)
print("Responsive HTML rendered: " + str(len(response.pages)) + " pages")
選択したページをレンダリングする
ドキュメントの特定のページのみを変換し、ドキュメントの一部のみが必要な場合に処理時間を節約します。
import groupdocs_viewer_cloud
view_api = groupdocs_viewer_cloud.ViewApi.from_keys("YourClientId", "YourClientSecret")
view_options = groupdocs_viewer_cloud.ViewOptions()
view_options.file_info = groupdocs_viewer_cloud.FileInfo()
view_options.file_info.file_path = "SampleFiles/sample.docx"
view_options.view_format = "HTML"
view_options.render_options = groupdocs_viewer_cloud.HtmlOptions()
view_options.render_options.pages_to_render = [2, 3]
request = groupdocs_viewer_cloud.CreateViewRequest(view_options)
response = view_api.create_view(request)
print("Selected pages rendered: " + str(len(response.pages)) + " pages")
変更を追跡して Word 文書をレンダリングする
出力 HTML の追跡された変更を含む Word ドキュメントをレンダリングします。
import groupdocs_viewer_cloud
view_api = groupdocs_viewer_cloud.ViewApi.from_keys("YourClientId", "YourClientSecret")
view_options = groupdocs_viewer_cloud.ViewOptions()
view_options.file_info = groupdocs_viewer_cloud.FileInfo()
view_options.file_info.file_path = "SampleFiles/with_tracked_changes.docx"
view_options.view_format = "HTML"
view_options.render_options = groupdocs_viewer_cloud.HtmlOptions()
view_options.render_options.word_processing_options = groupdocs_viewer_cloud.WordProcessingOptions()
view_options.render_options.word_processing_options.render_tracked_changes = True
request = groupdocs_viewer_cloud.CreateViewRequest(view_options)
response = view_api.create_view(request)
print("Tracked changes rendered: " + str(len(response.pages)) + " pages")
ドキュメント情報の取得
レンダリング前にページ数などのドキュメントのメタデータを取得します。
import groupdocs_viewer_cloud
info_api = groupdocs_viewer_cloud.InfoApi.from_keys("YourClientId", "YourClientSecret")
view_options = groupdocs_viewer_cloud.ViewOptions()
view_options.file_info = groupdocs_viewer_cloud.FileInfo()
view_options.file_info.file_path = "SampleFiles/sample.docx"
request = groupdocs_viewer_cloud.GetInfoRequest(view_options)
result = info_api.get_info(request)
print("Document pages: " + str(len(result.pages)))
クラウドストレージを使用せずに変換およびダウンロード
最初にクラウド ストレージにアップロードせずに、ローカル ドキュメントを直接レンダリングし、出力ファイルを受け取ります。
import groupdocs_viewer_cloud
view_api = groupdocs_viewer_cloud.ViewApi.from_keys("YourClientId", "YourClientSecret")
with open("sample.docx", "rb") as file:
request = groupdocs_viewer_cloud.ConvertAndDownloadRequest("jpg", file)
output_path = view_api.convert_and_download(request)
print("Convert and download completed: " + output_path)
GitHub のサンプル プロジェクト
のGroupDocs.Viewer Cloud Python Samplesリポジトリには、以下をカバーするすぐに実行できるサンプルが含まれています。
| カテゴリー | 例 |
|---|
| 基本的な使い方 | サポートされている形式、ドキュメント情報、添付ファイル、変換とダウンロード |
| HTML ビューア | レスポンシブ レイアウト、HTML の縮小、フォントの除外、印刷用の最適化 |
| 画像ビューア | 画像サイズ、JPG品質、テキストオーバーレイ、テキスト座標を調整 |
| PDF ビューア | PDF を保護し、JPG 品質を調整 |
| 一般的なレンダリング オプション | 透かし、選択したページ、連続したページ、コメント、メモ、カスタム フォント |
| 読み込みオプション | 保護されたドキュメント、エンコードを指定 |
| ファイル タイプ別のレンダリング | アーカイブ、CAD、電子メール、Outlook、PDF、スプレッドシート、Visio、Word、Lotus Notes、MS Project、テキスト |
サンプルの実行方法
- クローンを作成するか、ダウンロードします。samples repository2.
Examplesディレクトリ
3.編集RunExamples.pyそしてあなたの設定をclient_idそしてclient_secret4. 走るpip install groupdocs-viewer-cloud -U5. 実行python RunExamples.py
詳細については、次のサイトをご覧ください。Getting Started.

タグ
Document Rendering API | Python 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