Created
September 2, 2024 05:15
-
-
Save kinuasa/f37814cf7ea29afba16490be9867e09e to your computer and use it in GitHub Desktop.
CSVから読み込んだ値をフィールドに設定してPDFを別名保存するAcrobat JavaScriptのサンプルコード 関連Webサイト:https://rpacommunity.connpass.com/event/329227/
This file contains hidden or 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
| /* 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