跳到主要内容

SetIntent

设置此批注的意图类型。

语法

expression.SetIntent(intentType);

expression - 表示 ApiFreeTextAnnotation 类的变量。

参数

名称必需/可选数据类型默认值描述
intentType必需FreeTextIntent自由文本批注的意图类型。

返回值

boolean

示例

在 PDF 中为文本注释分配用途类型。

// How do I specify what kind of comment a text annotation is in a PDF?

// Define the annotation's purpose and verify it in a PDF.

let doc = Api.GetDocument();
let freeTextAnnot = Api.CreateFreeTextAnnot([160, 50, 360, 135]);
let page = doc.GetPage(0);
page.AddObject(freeTextAnnot);
freeTextAnnot.SetIntent("freeTextCallout");
freeTextAnnot.SetCallout([{x: 161, y: 51}, {x: 249, y: 125}, {x: 261, y: 125}]);
freeTextAnnot.SetRectDiff([100, 64, 0.5, 0.5]);
console.log(`Annot intent is: ${freeTextAnnot.GetIntent()}`);