Skip to content

Instantly share code, notes, and snippets.

@UskeS
Last active April 6, 2023 21:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UskeS/524d4a9c368c6c2fdf273cfa790a95c4 to your computer and use it in GitHub Desktop.
Save UskeS/524d4a9c368c6c2fdf273cfa790a95c4 to your computer and use it in GitHub Desktop.
[Acrobat]コメントを抽出してテキストファイルに書き出すAcrobat用スクリプト
var result = [];
for (var i = 0; i < numPages; i++) {
var annot = getAnnots(i); // ページに含まれる注釈コメント
if (!annot) { continue; } // nullが返ることがあるのでFalsyなら飛ばす
for (var j = 0, lenAnnot = annot.length; j < lenAnnot; j++) {
var myAnnots = [];
myAnnots.push("p." + (annot[j].page + 1));
myAnnots.push(annot[j].contents.replace(/\r/g, "<br>"));
result.push(myAnnots.join("\t")); // 区切り文字
}
}
exportTxtFile("hoge.txt", result.join("\r"));
function exportTxtFile(fileName, value) {
createDataObject({cName: fileName, cValue: value});
exportDataObject({cName: fileName});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment