tencent cloud

Cloud Infinite

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Product Overview
Product Strengths
Use Cases
Feature Overview
Regions and Domains
Specifications and Limits
Billing
Billing Overview
Billing Mode
Billable Items
Free Tier
Payment Overdue
Viewing Bill Details
FAQs
Getting Started
Registering and Logging In
Bind Bucket
Uploading and Processing File
Downloading and Deleting Images
Unbinding Buckets
Using CI via COS
Features
Image Processing
Media Processing
Content Moderation
AI Content Recognition
File Processing
Smart Voice
File processing
User Guide
Overview
Bucket Management
Smart Toolbox
Job and Workflow
Data Monitoring
Usage statistics
Use Cases
Copyright Protection Solutions
Image Processing Practices
Working with API Authorization Policies
Workflow Practices
API Documentation
API Overview
Structure
Common Request Headers
Common Response Headers
Activate Vast Service
Image Processing
AI-Based Content Recognition
Smart Audio
Media Processing
Content Moderation
Document Processing
File Processing
Job and Workflow
Cloud Virus Detection
Error Codes
Request Signature
SDK Documentation
SDK Overview
Android SDK
iOS SDK
COS Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Go SDK
COS iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
Mini Program SDK
Personal Information Protection Policy for SDK
Security and Compliance
Permission ‍Management
FAQs
Basic Settings
Document Processing
Media Processing
Content Recognition
Smart Audio
Agreements
Service Level Agreement
Contact Us
Glossary

Sync Request API

PDF
フォーカスモード
フォントサイズ
最終更新日: 2024-03-01 14:57:12

Overview

This document provides an overview of APIs and SDK code samples for sync requests for file preview.
API
Description
Synchronously requests for file preview.

Sync Request API

Feature description

This API is used to synchronously request for file preview.

Method prototype

def ci_doc_preview_process(self, Bucket, Key, SrcType=None, Page=None, DstType=None, PassWord=None, Comment=0, Sheet=1,
ExcelPaperDirection=0, ExcelRow=0, ExcelCol=0, ExcelPaperSize=None, TxtPagination=False,
ImageParams=None, Quality=100, Scale=100, ImageDpi=96, **kwargs)

Sample request

def ci_doc_preview_process():
# Sync file preview API
response = client.ci_doc_preview_process(
Bucket=bucket_name,
Key='1.txt',
)
print(response)
response['Body'].get_stream_to_file('result.png')

Parameter description

Parameter
Description
Type
Bucket
Bucket of the object
String
Key
Object name, such as folder/document.pdf.
String
SrcType
Source data type. Currently, the file conversion feature determines the source data type according to the file extension of the COS object. If the object has no extension, you can set this value.
String
Page
Number of the page to be converted, which is counted from 1 by default. For spreadsheets, page indicates to convert the xth image in the xth sheet.
int
DstType
Type of the output target image file. Valid values: png, jpg, pdf. If the input file format cannot be recognized, the jpg format will be used by default.
String
Password
Password to open the Office file. If you need to convert a password-protected file, set this field.
String
Comment
Whether to hide comments and apply track changes. 0: hide comments and apply track changes; 1: show comments and track changes. Default value: 0.
int
Sheet
Sheet parameter, indicating to convert the xth sheet. Default value: 1.
int
ExcelPaperDirection
Paper orientation of the spreadsheet. 0: vertical; other values: horizontal. Default value: 0.
int
ExcelRow
The value 1 indicates that all rows will be formatted on one page. Default value: 0.
int
ExcelCol
The value 1 indicates that all columns will be formatted on one page. Default value: 0.
int
ExcelPaperSize
Page (canvas) size. Valid values: 0 (A4), 1 (A2), 2 (A0). Default value: 0. This parameter needs to be used together with excelRow or excelCol.
int
TxtPagination
Whether to convert to long text. When this parameter is set to true, the text in the pages to be exported can be combined before export, and the pagination range can be controlled by Ranges. The default value is false, indicating to generate .txt files by page. This parameter takes effect only if ExportType is txt.
bool
ImageParams
Processing parameters for the output image. All parameters of basic image processing are supported. To specify multiple parameters, separate them with pipeline operators. In this way, the image can be processed by multiple parameters in sequence in the same request.
String
Quality
Quality of the generated preview image. Value range: [1-100]. Default value: 100. For example, if the value is 100, the quality of the generated image will be 100%.
int
Scale
Scaling parameter of the preview image. Value range: [10, 200]. Default value: 100. For example, if the value is 200, the image will be scaled up (enlarged) by 200%.
int
ImageDpi
Renders the image according to the specified DPI. This parameter works together with scale. Value range: 96–600. Default value: 96. The width of the output image must be less than 65500 px.
int

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック