跳到主要内容

CreateImageStampAnnot

从图像创建图章注释。注释尺寸取自已加载的图像,或在图像加载后更新。

语法​

expression.CreateImageStampAnnot(position, imageSrc, author, creationDate);

expression - 表示 Api 类的变量。

参数​

名称必需/可选数据类型默认值描述
position必需Point | Rect注释左上角的位置。对于 Rect,仅使用 x1 和 y1。
imageSrc必需string图像的来源(目前仅支持 Internet URL 或 Base64 编码的图像)。
author可选string作者姓名
creationDate可选number创建日期(时间戳)

返回值​

ApiStampAnnotation

示例​

向 PDF 页面添加图像图章注释。

// Create a PDF stamp annotation using an image URL.

// Place an image stamp at specified coordinates in a PDF.

let doc = Api.GetDocument();
let imageAnnot = Api.CreateImageStampAnnot(
[40, 40, 160, 100],
'https://static.onlyoffice.com/assets/docs/samples/img/onlyoffice_logo.png'
);
let page = doc.GetPage(0);
page.AddObject(imageAnnot);