Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kinuasa/f37814cf7ea29afba16490be9867e09e to your computer and use it in GitHub Desktop.
Save kinuasa/f37814cf7ea29afba16490be9867e09e to your computer and use it in GitHub Desktop.
CSVから読み込んだ値をフィールドに設定してPDFを別名保存するAcrobat JavaScriptのサンプルコード 関連Webサイト:https://rpacommunity.connpass.com/event/329227/
/* CSVデータ(1行目:見出し, フィールド名)を読み込みフォーム入力 */
var stream = util.readFileIntoStream("/C/Test/PDF/output/SrcData.csv");
var lines = util.stringFromStream(stream, "utf-8").split("\n");
var headers = lines[0].split(",");
lines.slice(1).forEach((line, i) => {
var values = line.split(",");
headers.forEach((header, j) => {
var field = this.getField(header);
if (field) field.value = values[j] || "";
});
this.saveAs({
cPath: "/C/Test/PDF/output/output_" + i + ".pdf",
bCopy: true
});
});
app.alert("処理が終了しました。");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment