跳到主要内容

SetIconType

Sets icon type for this annotation.

Syntax

expression.SetIconType(iconType);

expression - A variable that represents a ApiTextAnnotation class.

Parameters

NameRequired/OptionalData typeDefaultDescription
iconTypeRequiredTextIconTypeNo description provided.

Returns

boolean

Example

This example sets new icon type for text annotation.

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}`);