tencent cloud

Feedback

Sync Request API

Last updated: 2024-02-29 16:52:32

    Overview

    This document provides an overview of APIs and SDK code samples for sync requests for document preview.
    API
    Description
    Submits a sync request for document preview.

    Sync Request API

    Feature description

    This API is used to submit a sync request for document preview.

    Method prototype

    func (s *CIService) DocPreview(ctx context.Context, name string, opt *DocPreviewOptions) (*Response, error)

    Sample request

    opt := &cos.DocPreviewOptions{
    Page: 1,
    }
    resp, err := c.CI.DocPreview(context.Background(), "form.pdf", opt)

    Parameter description

    type DocPreviewOptions struct {
    SrcType string
    Page int
    ImageParams string
    Sheet int
    DstType string
    Password string
    Comment int
    ExcelPaperDirection int
    Quality int
    Zoom 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
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support