我正在尝试通过Acrobat javascript在pdf文档中添加多个注释。但是,如果我同时包含这两个注释,则只有第一个注释可用。第二个注释仅在我单独包含该注释时才有效。
var spans = new Array();
spans[0] = new Object();
spans[0].text = "Links to: ";
spans[0].textSize = 12;
spans[0].textColor = color.red;
spans[1] = new Object();
spans[1].text = "http://www.example.com";
spans[1].textSize = 12;
spans[1].textColor = color.black;
// Now create the annot with spans as it's richContents
var annot = this.addAnnot({
page: 0,
type: "FreeText",
rect: [50, 50, 300, 100],
richContents: spans
});
var copy_annot = this.addAnnot({type: "Line"})
annot.setProps({
page: 0,
points: [[400,490],[430,690]],
strokeColor: color.red,
arrowBegin: "Diamond",
arrowEnd: "OpenArrow"
});
答案 0 :(得分:0)
在设置属性
之前,我忘了更改变量名称<强>解决方案:强>
var copy_annot = this.addAnnot({type: "Line"})
copy_annot.setProps({
...
});