2017-02-09 70 views

回答

1

需要設置文本字段屬性以允許富文本格式。然後,您需要創建一個Span對象數組,其中包含具有所需格式的文本。

var spans = new Array(); 
spans[0] = new Object(); 
spans[0].text = "Attention:\r"; 
spans[0].textStyle = "bold"; 
spans[0].textSize = 18; 

spans[1] = new Object(); 
spans[1].text = "Adobe Acrobat DC\r"; 
spans[1].textColor = color.red; 
spans[1].textSize = 20; 
spans[1].alignment = "center"; 

spans[2] = new Object(); 
spans[2].text = "will soon be here!"; 
spans[2].textColor = color.green; 
spans[2].fontStyle = "italic"; 
spans[2].underline = true; 
spans[2].alignment = "right"; 

// 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 

});

相關問題