GET /<ObjectKey>?ci-process=doc-preview&page=<page>&srcType=<srcType>&ImageParams=<ImageParams> HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth String
Parameter | Description | Type | Required |
ObjectKey | Object name, such as folder/document.pdf . | String | Yes |
ci-process | CI's processing capability, which is fixed at doc-preview for file preview. | String | Yes |
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 | No |
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 | No |
dstType | Type of the output target file. Valid values: png jpg pdf (the page number cannot be selected, and the page parameter does not take effect) txt If the input file format cannot be recognized, the jpg format will be used by default. | String | No |
password | Password to open the Office file. If you need to convert a password-protected file, set this field. | String | No |
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 | No |
Parameter | Description | Type | Required |
sheet | Sheet parameter, indicating to convert the xth sheet. Default value: 1 . | Int | No |
excelPaperDirection | Paper orientation of the spreadsheet. 0 : vertical; other values: horizontal. Default value: 0 . | Int | No |
excelRow | The value 1 indicates that all rows will be formatted on one page. Default value: 0 . | Int | No |
excelCol | The value 1 indicates that all columns will be formatted on one page. Default value: 0 . | Int | No |
excelPaperSize | Paper (canvas) size. Valid values: 0 (A4), 1 (A2), 2 (A0). Default value: 0 . This parameter should be used together with excelRow or excelCol . | Int | No |
Parameter | Description | Type | Required |
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 | No |
Name | Description | Type | Required |
ImageParams | Processing parameters for the output image. All parameters of basic image processing are supported. To specify multiple parameters, separate them by pipeline operator. In this way, the image can be processed by multiple parameters in sequence in the same request. | String | No |
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 | No |
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 | No |
imageDpi | Renders the image based on 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 | No |
Parameter | Description | Type |
X-Total-Page | Total number of pages in the file (or images converted from sheets in the spreadsheet file) returned in the HTTP header. This value will be empty in case of an exception. | Int |
Content-Type | Different values will be returned based on the actual image format, such as image/jpeg and image/webp . | String |
X-ErrNo | The error code returned in case of an exception, which can be viewed in the HTTP header. | String |
X-Total-Sheet | Total number of sheets in the spreadsheet file returned in the HTTP header. | Int |
X-Sheet-Name | Name of the current sheet in the spreadsheet file returned in the HTTP header. | String |
GET /sample.pdf?ci-process=doc-preview&page=1 HTTP/1.1Host: examplebucket-1250000000.cos.ap-shanghai.myqcloud.com
HTTP/1.1 200 OKContent-Type: image/jpegContent-Length: 645Date: Tue, 03 Apr 2018 09:06:16 GMTX-Total-Page: 100[Image data after transcoding]
HTTP/1.1 404 OKConnection: closeContent-Length: 455Content-Type: application/xmlDate: Thu, 09 Apr 2020 13:44:52 GMTX-ErrNo: -3004
HTTP/1.1 404 OKConnection: closeContent-Length: 455Content-Type: application/xmlDate: Thu, 09 Apr 2020 13:44:52 GMTX-ErrNo: -3013
GET /sample.pdf?ci-process=doc-preview&page=1&ImageParams=imageMogr2/thumbnail/!50p|watermark/2/text/5pWw5o2u5LiH6LGh/fill/I0ZGRkZGRg==/fontsize/30/dx/20/dy/20 HTTP/1.1Host: examplebucket-1250000000.cos.ap-shanghai.myqcloud.com
HTTP/1.1 200 OKContent-Type: image/jpegContent-Length: 645Date: Tue, 03 Apr 2018 09:06:16 GMTX-Total-Page: 100[Image data after transcoding]
HTTP/1.1 404 OKConnection: closeContent-Length: 455Content-Type: application/xmlDate: Thu, 09 Apr 2020 13:44:52 GMTX-ErrNo: -3004
HTTP/1.1 404 OKConnection: closeContent-Length: 455Content-Type: application/xmlDate: Thu, 09 Apr 2020 13:44:52 GMTX-ErrNo: -3013
Was this page helpful?