超过 1 个注释实例在 Acrobat 中不起作用
More than 1 instance of annotation not working in Acrobat
我正在尝试通过 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"
});
我忘记在设置 属性
之前更改变量名称
解法:
var copy_annot = this.addAnnot({type: "Line"})
copy_annot.setProps({
...
});
我正在尝试通过 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"
});
我忘记在设置 属性
之前更改变量名称解法:
var copy_annot = this.addAnnot({type: "Line"})
copy_annot.setProps({
...
});