製品を閲覧する

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

インストール

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

pip install groupdocs-conversion-cloud

PyPI - Version PyPI - Downloads Python-GroupDocsCloud


要件

  • Python 2.7 または 3.4+
  • pip パッケージマネージャー
  • GroupDocs クラウド認証情報Client ID and Client Secretダッシュボードから

依存関係

SDK は次のパッケージを自動的にインストールします。

パッケージ制約
urllib3>= 1.15
six>= 1.10
certifi
python-dateutil

クイックスタート

API 認証情報を取得する

GroupDocs.Conversion Cloud を使用するには、次の URL でサインアップしてください。GroupDocs.Cloud Dashboardクライアント IDクライアント シークレット を取得します。

API を初期化する

GroupDocs.Conversion Cloud SDK for Python の使用を開始するには、次のコードを使用します。

import groupdocs_conversion_cloud

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

# Create API configuration
configuration = groupdocs_conversion_cloud.Configuration(client_id, client_secret)
configuration.api_base_url = "https://api.groupdocs.cloud"

# Create instance of the Convert API
convert_api = groupdocs_conversion_cloud.ConvertApi.from_config(configuration)

ドキュメントを変換する (直接、クラウド ストレージなし)

初期化したら、この基本的な例を使用してローカル ドキュメントを変換し、結果を直接受け取ります。

import groupdocs_conversion_cloud

client_id = "YourClientId"
client_secret = "YourClientSecret"

# Create instance of the API
convert_api = groupdocs_conversion_cloud.ConvertApi.from_keys(client_id, client_secret)

# Prepare request: output format and local file path
request = groupdocs_conversion_cloud.ConvertDocumentDirectRequest("pdf", "input.docx")

# Convert and save the result
result = convert_api.convert_document_direct(request)

with open("output.pdf", "wb") as f:
    f.write(result)

With this quick start guide, you’re all set to begin converting documents using GroupDocs.Conversion Cloud in your Python applications.詳細については、次のサイトを参照してください。documentation.

クラウドストレージを使用してドキュメントを変換する

この例では、ファイルを GroupDocs クラウド ストレージにアップロードし、変換して、結果をダウンロードします。これは、クラウドでファイルを管理するサーバー側のワークフローに最適です。

import groupdocs_conversion_cloud

client_id = "YourClientId"
client_secret = "YourClientSecret"

# Create instances of the APIs
file_api = groupdocs_conversion_cloud.FileApi.from_keys(client_id, client_secret)
convert_api = groupdocs_conversion_cloud.ConvertApi.from_keys(client_id, client_secret)

# Upload file to cloud storage
file_api.upload_file(
    groupdocs_conversion_cloud.UploadFileRequest("myFile.docx", "myFile.docx")
)

# Prepare convert settings
settings = groupdocs_conversion_cloud.ConvertSettings()
settings.file_path = "myFile.docx"
settings.format = "pdf"
settings.output_path = "converted"

# Convert the document
result = convert_api.convert_document(
    groupdocs_conversion_cloud.ConvertDocumentRequest(settings)
)

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

# Download the converted file
response = file_api.download_file(
    groupdocs_conversion_cloud.DownloadFileRequest("converted/myFile.pdf", None)
)

さまざまな形式間でドキュメントを変換するクラウド API

このコードにより、開発者は高度な PDF 出力オプションを使用してプログラムでさまざまな形式の間でドキュメントを変換できるため、手動による変換が不要になります。 50 を超えるファイル形式をサポートしているため、マルチ形式のサポートを必要とするアプリケーション開発者に最適です。

import groupdocs_conversion_cloud

configuration = groupdocs_conversion_cloud.Configuration("YourClientId", "YourClientSecret")
convert_api = groupdocs_conversion_cloud.ConvertApi.from_config(configuration)

# Prepare convert settings
settings = groupdocs_conversion_cloud.ConvertSettings()
settings.file_path = "WordProcessing/password-protected.docx"
settings.format = "pdf"
settings.output_path = "converted"

# Load options for password-protected source document
load_options = groupdocs_conversion_cloud.WordProcessingLoadOptions()
load_options.password = "password"

# PDF conversion options
convert_options = groupdocs_conversion_cloud.PdfConvertOptions()
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

# Execute the conversion
result = convert_api.convert_document(
    groupdocs_conversion_cloud.ConvertDocumentRequest(settings)
)

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

Document Cloud API の特定のページを変換する

この例では、ドキュメントの一部のみが必要な場合に、開発者が特定のページのみを変換して処理時間を節約し、ファイル サイズを削減する方法を示します。

import groupdocs_conversion_cloud

convert_api = groupdocs_conversion_cloud.ConvertApi.from_keys("YourClientId", "YourClientSecret")

# Configure settings to convert specific pages (e.g., pages 1 and 3)
settings = groupdocs_conversion_cloud.ConvertSettings()
settings.file_path = "WordProcessing/four-pages.docx"
settings.format = "pdf"
settings.output_path = "converted/two-pages.pdf"

convert_options = groupdocs_conversion_cloud.PdfConvertOptions()
convert_options.pages = [1, 3]
settings.convert_options = convert_options

# Execute the conversion
result = convert_api.convert_document(
    groupdocs_conversion_cloud.ConvertDocumentRequest(settings)
)

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

サポートされている変換形式を取得する

API を通じて利用できる、サポートされているソースからターゲットへの形式変換の完全なリストを取得します。

import groupdocs_conversion_cloud

info_api = groupdocs_conversion_cloud.InfoApi.from_keys("YourClientId", "YourClientSecret")

result = info_api.get_supported_conversion_types(
    groupdocs_conversion_cloud.GetSupportedConversionTypesRequest()
)

print("Formats count: " + str(len(result)))

GitHub のサンプル プロジェクト

GroupDocs.Conversion Cloud Python Samplesリポジトリには、以下をカバーするすぐに実行できるサンプルが含まれています。

カテゴリー
変換PDF、HTML、画像、プレゼンテーション、スプレッドシート、ワードプロセッサ。直接変換。非同期変換
一般的なオプション透かし、特定のページ、連続したページ、カスタム フォント
ロード オプションCAD、CSV、電子メール、HTML、OneNote、PDF、プレゼンテーション、スプレッドシート、テキスト、ワードプロセッサ
情報サポートされている変換、ドキュメント情報

サンプルの実行方法

  1. クローンを作成するか、ダウンロードします。samples repository2.編集Examples/Common.pyそしてあなたの設定をclient_idそしてclient_secret3. に移動します。Examplesディレクトリ
  2. 走るpip install groupdocs-conversion-cloud -U5. 実行python RunExamples.py

詳細については、次のサイトをご覧ください。Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


タグ

Document Conversion API | Python 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, Python | Secure API Access | Docker Support | Scalable Document Conversion | API Rate Limiting


 日本