2017-02-10 30 views
0

我試圖通過Acrobat javascript在pdf文檔中添加多個註釋。但是,如果我同時包含這兩個,則只有第一個註釋正在工作。如果我單獨包含那一個,則第二個註釋才起作用。超過1個註釋在Acrobat中不起作用

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

我已經忘了設置屬性

解決方案之前更改變量名:

var copy_annot = this.addAnnot({type: "Line"}) 
    copy_annot.setProps({ 
    ... 
});