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.

安装
该软件包在PyPI可用,可以通过执行以下命令通过pip安装:
pip install groupdocs-conversion-cloud

要求
依赖关系
SDK自动安装以下软件包:
| Package | Constraint |
|---|
| urllib3 | >= 1.15 |
| six | >= 1.10 |
| certifi | — |
| python-dateutil | — |
快速入门
获取您的 API 凭证
要使用GroupDocs.Conversion Cloud,请在GroupDocs.Cloud仪表板注册并获取您的Client ID和Client Secret。
初始化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)
通过本快速入门指南,您已准备好开始在 Python 应用程序中使用 GroupDocs.Conversion Cloud 转换文档。欲了解更多详情,请访问文档。
使用云存储转换Documents
此示例将文件上传到 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)
)
各种格式之间转换Documents Cloud 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 示例 存储库包含可立即运行的示例,涵盖:
| Category | Examples |
|---|
| Convert | PDF, HTML, image, presentation, spreadsheet, word processing; direct conversion; async conversion |
| Common Options | Watermarks, specific pages, consecutive pages, custom fonts |
| Load Options | CAD, CSV, email, HTML, OneNote, PDF, presentation, spreadsheet, text, word processing |
| Info | Supported conversions, document information |
如何运行示例
- 克隆或下载示例存储库
- 编辑
Examples/Common.py并设置client_id和client_secret
3.进入Examples目录
4.运行pip install groupdocs-conversion-cloud -U
5.执行python RunExamples.py
欲了解更多详情,请访问入门。

标签
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