const tencentcloud = require("../../../../tencentcloud-sdk-nodejs");
const OcrClient = tencentcloud.ocr.v20181119.Client;
const models = tencentcloud.ocr.v20181119.Models;
const Credential = tencentcloud.common.Credential;
const ClientProfile = tencentcloud.common.ClientProfile;
const HttpProfile = tencentcloud.common.HttpProfile;
let cred = new Credential(" SecretId ", " SecretKey ");
let httpProfile = new HttpProfile();
let clientProfile = new ClientProfile();
/*
推荐使用 V3 鉴权。当内容超过 1M 时,必须使用 V3 签名鉴权。除 Node SDK 外,其他语言 SDK 都支持 V3。
clientProfile.signMethod = "TC3-HMAC-SHA256";
*/
clientProfile.httpProfile = httpProfile;
let client = new OcrClient(cred, "ap-guangzhou", clientProfile);
let req = new models.IDCardOCRRequest();
req.ImageUrl = "[https://test.jpg](https://test.jpg/)";
req.CardSide = "FRONT";
let config = {"CropPortrait":true};
req.Config = JSON.stringify(config)
client.IDCardOCR(req, function(errMsg, response) {
if (errMsg) {
console.log(errMsg);
return;
}
console.log(response.to_json_string());
});
本页内容是否解决了您的问题?