Skip to content

Instantly share code, notes, and snippets.

@monokano
Last active April 5, 2024 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monokano/2e635c572357482112d8cce4fe2245d8 to your computer and use it in GitHub Desktop.
Save monokano/2e635c572357482112d8cce4fe2245d8 to your computer and use it in GitHub Desktop.
コメント末尾の改行を削除するAcrobatのJavaScript
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){}
});
@monokano
Copy link
Author

@monokano
Copy link
Author

http://dtptokadensyo.blog.fc2.com/blog-entry-49.html
こちらの記事を真似してAcrobatの編集メニューに表示されるようにしました。

screen-shot

@monokano
Copy link
Author

monokano commented Apr 5, 2024

注意
実行するとコメントの文字が真っ白に変わってしまう(視認できなくなる)ケースがまれにありました…。
原因がまったく分からず、対処できない状況です。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment