【Foxit PDF SDK】福昕GSDK如何使用JavaScript获取/设置PDF注释的属性(strokeColor、fillColor、readOnly、rect、type)?

请参考以下代码:

// 获取注解的属性.

JavaScriptAction javascipt_action = new JavaScriptAction(Action.create(form.getDocument(),

Action.e_TypeJavaScript));

javascipt_action.setScript("var ann = this.getAnnot(0, \" UniqueID \"); if (ann != null) { console.println(\"Found it!

type: \" + ann.type); console.println(\"readOnly: \" + ann.readOnly); console.println(\"strokeColor: \" +

ann.strokeColor);console.println(\"fillColor: \" + ann.fillColor); console.println(\"rect: \" + ann.rect);}");

AdditionalAction aa = new AdditionalAction(field);

aa.setAction(AdditionalAction.e_TriggerAnnotCursorEnter, javascipt_action);

aa.doJSAction(AdditionalAction.e_TriggerAnnotCursorEnter);

// 设置注释属性(仅以strokeColor为例).

JavaScriptAction javascipt_action1 = new JavaScriptAction(Action.create(form.getDocument(),

Action.e_TypeJavaScript));

javascipt_action1.setScript("var ann = this.getAnnot(0, \"UniqueID\"); if (ann != null) { ann.strokeColor =

color.blue; }");

AdditionalAction aa1 = new AdditionalAction(field1);

aa1.setAction(AdditionalAction.e_TriggerAnnotCursorEnter, javascipt_action1);

aa1.doJSAction(AdditionalAction.e_TriggerAnnotCursorEnter);