API | Operation | Description |
Getting the request URL for file-to-HTML conversion | Gets the request URL for file-to-HTML conversion. |
<?phprequire dirname(__FILE__, 2) . '/vendor/autoload.php';$secretId = "SECRETID"; //Replace it with the actual `SecretId`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi$secretKey = "SECRETKEY"; //Replace it with the actual `SecretKey`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi$region = "ap-beijing"; //Replace it with the actual `region`, which can be viewed in the console at https://console.tencentcloud.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //Protocol header, which is http by default'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {// 2. Convert the file to HTML. For more information, visit https://www.tencentcloud.com/document/product/460/52518?from_cn_redirect=1.$bucket = 'examplebucket-1250000000';$key = 'exampleobject';$url = $cosClient->getObjectUrl($bucket, $key, "+30 minutes");$params = array('ci-process' => 'doc-preview',// 'srcType' => '','dstType' => 'html',// 'sign' => '',// 'copyable' => '',// 'htmlParams' => '',// 'htmlwaterword' => '',// 'htmlfillstyle' => '',// 'htmlfront' => '',// 'htmlrotate' => '',// 'htmlhorizontal' => '',// 'htmlvertical' => '',);$query = http_build_query($params);echo $url . $query; // The generated accessible URL} catch (\\Exception $e) {// Request failedecho($e);}
Name | Description | Type | Required |
Key | Object filename, such as folder/document.pdf . | String | Yes |
ci-process | CI's processing capability, which is fixed at doc-preview for file preview in HTML. | String | Yes |
dstType | Output target file type, which is fixed at html for HTML preview. | String | Yes |
srcType | Source file type as listed below. | String | No |
sign | Object download signature, which must be URL-encoded. If the previewed object is privately readable, the signature needs to be passed in. | String | No |
copyable | Whether the file content is copyable. Valid values: 1 (yes), 0 (no). | String | No |
htmlParams | Custom configuration parameters in JSON structure, which must be URL-safe Base64-encoded as described in FAQs. Default configuration: { commonOptions: { isShowTopArea: true, isShowHeader: true } }. For supported configurations, see Custom Configuration Overview. | String | No |
htmlwaterword | String | No | |
htmlfillstyle | Watermark RGBA (color and transparency), which must be URL-safe Base64-encoded as described in FAQs and is rgba(192,192,192,0.6) by default. | String | No |
htmlfront | Watermark text style, which must be URL-safe Base64-encoded as described in FAQs and is bold 20px Serif by default. | String | No |
htmlrotate | Rotation angle of the watermark text in degrees. Value range: 0–360. Default value: 315 . | String | No |
htmlhorizontal | Horizontal spacing of the watermark text in px. Default value: 50 . | String | No |
htmlvertical | Vertical spacing of the watermark text in px. Default value: 100 . | String | No |
Sync request URLhttps://examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com/example.ppt?sign=q-sign-algorithmxxxxxxxxxxxxx&ci-process=doc-preview&dstType=html
Was this page helpful?