フィールド スクリプトの設定

フィールド スクリプトの設定

  1. ソース PDF を FormEditor ファサードにバインドしてください。
  2. フィールドに初期の JavaScript アクションを追加してください。
  3. それを更新されたスクリプト テキストに置き換えてください。
  4. 更新されたドキュメントを保存してください。
public static void setFieldScript(Path inputFile, Path outputFile) {
    FormEditor editor = new FormEditor();
    try {
        editor.bindPdf(inputFile.toString());
        editor.addFieldScript("Script_Demo_Button", "app.alert('Script 1 has been executed');");
        editor.setFieldScript("Script_Demo_Button", "app.alert('Script 2 has been executed');");
        editor.save(outputFile.toString());
    } finally {
        editor.close();
    }
}