API | Description |
Submits a sync request for document preview. |
func (s *CIService) DocPreview(ctx context.Context, name string, opt *DocPreviewOptions) (*Response, error)
opt := &cos.DocPreviewOptions{Page: 1,}resp, err := c.CI.DocPreview(context.Background(), "form.pdf", opt)
type DocPreviewOptions struct {SrcType stringPage intImageParams stringSheet intDstType stringPassword stringComment intExcelPaperDirection intQuality intZoom int}
Parameter | Description | Type |
name | Object name, such as folder/document.pdf | String |
SrcType | Source data type. Currently, the document 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 document page to be converted, which is counted from 1 by default. For spreadsheets, page indicates the number of the part in the specified sheet to be converted. | int |
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 based on multiple parameters in sequence in the same request. | String |
Sheet | Spreadsheet parameter, indicating the number of the sheet to be converted. Default value: 1 | int |
DstType | Output file extension. Valid values: png jpg pdf If the specified value cannot be recognized, jpg is used. | String |
Password | Password to open the Office document. If you need to convert a password-protected document, set this parameter. | String |
Comment | Whether to hide comments and tracked changes. 0 (default): Hide comments and tracked changes. 1: Show comments and tracked changes. | int |
ExcelPaperDirection | Paper orientation of the spreadsheet. 0 (default): Vertical; other values: Horizontal | int |
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 |
Zoom | Scaling parameter of the preview image. Value range: [10-200]. Default value: 100. For example, if the value is 200 , the image will be zoomed in (enlarged) by 200%. | int |
Was this page helpful?