跳到主要内容

SetIconType

设置此批注的图标类型。

语法

expression.SetIconType(iconType);

expression - 表示 ApiTextAnnotation 类的变量。

参数

名称必需/可选数据类型默认值描述
iconType必需TextIconType未提供描述。

返回值

boolean

示例

此示例为文本注释设置新的图标类型。

let doc = Api.GetDocument();
let textAnnot = Api.CreateTextAnnot([10, 10, 20, 20]);
let oldIcon = textAnnot.GetIconType();
textAnnot.SetContents("Annot contents");
textAnnot.SetIconType("star");
let newIcon = textAnnot.GetIconType();

let page = doc.GetPage(0);
page.AddObject(textAnnot);
console.log(`Changed icon from: ${oldIcon} to ${newIcon}`);