Last active
April 5, 2024 07:57
-
-
Save monokano/2e635c572357482112d8cce4fe2245d8 to your computer and use it in GitHub Desktop.
コメント末尾の改行を削除するAcrobatのJavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.addMenuItem({ | |
cName: "Remove newlines at the end of comments", | |
cUser: "\u30B3\u30E1\u30F3\u30C8\u672B\u5C3E\u306E\u6539\u884C\u3092\u524A\u9664", | |
cParent: "Edit", | |
nPos:-1, | |
cEnable:!1, | |
cExec: "Remove_newlines()" | |
}); | |
app.addMenuItem({ | |
cName: "Bar", | |
cUser:"-", | |
cParent: "Edit", | |
nPos:0, | |
cEnable:!1, | |
cExec: "" | |
}); | |
Remove_newlines = app.trustedFunction(function (){ | |
try{ | |
this.syncAnnotScan(); | |
var annots = this.getAnnots(); | |
if (annots!=null) { | |
for (var i in annots) { | |
var annot = annots[i]; | |
annot.contents = annot.contents.replace(/\r+$/, ""); | |
} | |
} | |
}catch(e){} | |
}); |
http://dtptokadensyo.blog.fc2.com/blog-entry-49.html
こちらの記事を真似してAcrobatの編集メニューに表示されるようにしました。
注意
実行するとコメントの文字が真っ白に変わってしまう(視認できなくなる)ケースがまれにありました…。
原因がまったく分からず、対処できない状況です。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://community.adobe.com/t5/acrobat-discussions/remove-line-breaks-in-comments/td-p/11693649
こちらの回答を参考にしました。