1
我正在使用Adobe Pro編輯已在FreeText註釋表單中輸入大量添加的PDF。
現在我想編寫一個腳本來將這些文本顏色更改爲黑色。它已經適用於Lines/Circles/...,但不適用於實際的文本。Adobe Pro:使用Javascript更改自由文本註釋的顏色
這裏是我到目前爲止有:
/* Bla */
var myDoc = event.target.doc;
if(!myDoc)
console.println("Failed to access document");
else
console.println("Opened Document");
//Color all Comments in Black
function colorComments(myDoc)
{
//Get a list of Comments
var commentList = myDoc.getAnnots();
if(commentList == null)
{
console.println("Failed to get Comments");
}
else
{
console.println("Found " + commentList.length + " Comments, Iterating through comments");
}
//Iterate through the comment List and change the Colors
for each(comment in commentList)
{
if(comment == null)
{
console.println("Found undefined annot!");
}
switch(comment.type)
{
case "FreeText":
{
//change stroke color
comment.strokeColor = color.black;
var contents = comment.richContents;
//Go through all spans and change the text color in each one
for each(s in contents)
{
console.println(s.text);
s.textColor = color.black;
}
break;
}
}
}
}
colorComments(myDoc);
它打印在控制檯中的文本內容,但顏色完全不改變。