メモ
テキストボックス注釈のサイズを定規とガイドで調整する作業が面倒な場合もあるので、Doc.selectedAnnots で取得した FreeText の rect プロパティを正方形サイズにすることで作業効率化につながらないか考える。
使い捨てスクリプト
- JavaScriptデバッガーを表示する手順例
- しおりのアクションでJavaScriptを実行
- console.show();
- しおりのアクションでJavaScriptを実行
- JavaScriptデバッガーでの実行方法
- テキストを範囲選択して Ctrl + Enter
- JavaScriptフォルダの確認
- JavaScriptデバッガーで app.getPath を実行
- app.getPath({cCategory: "user", cFolder: "javascript"});
- JavaScriptデバッガーで app.getPath を実行
// Acrobat Standard DC (2023年2月頃), Windows 11 // ファイル名: *.js // エンコード: ANSI var str = "(" + (() => { var xll, yll; const doc = this; const annots = doc.selectedAnnots; const dLmm = 5.0; const dLpt = dLmm / 25.4 * 72; if (annots == null) { return; } annots.forEach(annot => { if (annot.type == "FreeText") { [xll, yll] = annot.rect.slice(0, 2); annot.setProps({ rect: [xll, yll, xll + dLpt, yll + dLpt], style: "S", borderEffectStyle: "", width: 1 }); } }); }).toString() + ")();"; app.addSubMenu({ cName: "MyEditAnnotFreeText", cUser: "テキストボックス注釈", cParent: "Edit", nPos: 0 }); app.addMenuItem({ cName: "MyAnnotFreeTextRect", cUser: "選択されたテキストボックス注釈のサイズを正方形に変更", cParent: "MyEditAnnotFreeText", nPos: 0, cExec: str, cEnable: "event.rc = (event.target != null);", cMarked: "event.rc = false", bPrepend: false }); app.addMenuItem({ cName: "-", cParent: "Edit", nPos: 1, cExec: "", bPrepend: true });