「Acrobat PDF 結合 コマンドライン」といったキーワード検索でのアクセスがありました。
AcrobatによるPDFファイルの結合処理をコマンドラインから実行したい方による検索だと思います。
Adobeフォーラムの下記スレッドを見る限り、残念ながらAcrobatにはそういった機能は用意されていないようです(Distillerの方は未確認です)。
> Is there a way to combine pdf files from the command line on Windows by passing arguments in to an executable? I have Acrobat XI Pro.
Not out of the box, no, Acrobat doesn’t support that functionality. You could, however, write a command line program that would call on Acrobat to do the work, however. You could also write a program inside of Acrobat to do this, either as a plugin or via JavaScript.
Combine PDF files programmatically(https://forums.adobe.com/thread/1524493) より
そこで、数年前に書いた下記マクロを手直しして、ドラッグ&ドロップした複数のPDFファイルを結合するVBScriptを書いてみました。
'**********************************************
' Acrobatを使ってPDFファイルを結合するVBScript
' @kinuasa
'**********************************************
Option Explicit
Dim args
Dim fso
Dim pdoc
Dim n, ts, fp
Dim cnt, i
Const PDSaveFull = 1
Const OutputFileName = "merged_" '結合後のファイル名
Set args = WScript.Arguments
If args.Count < 1 Then
MsgBox "当スクリプトにPDFファイルをドラッグ&ドロップして処理を実行してください。", vbExclamation + vbSystemModal
WScript.Quit
End If
cnt = 0
Set fso = CreateObject("Scripting.FileSystemObject")
For i = 0 To args.Count - 1
Select Case LCase(fso.GetExtensionName(args(i)))
Case "pdf": cnt = cnt + 1
End Select
Next
If cnt < 2 Then
MsgBox "2個以上のPDFファイルを選択してください。", vbExclamation + vbSystemModal
WScript.Quit
End If
'出力先設定
n = Now()
ts = Year(n) & Right("0" & Month(n), 2) & _
Right("0" & Day(n), 2) & Right("0" & Hour(n), 2) & _
Right("0" & Minute(n), 2) & Right("0" & Second(n), 2)
fp = fso.BuildPath(fso.GetFile(args(0)).ParentFolder.Path, OutputFileName & ts & ".pdf")
With CreateObject("AcroExch.PDDoc")
If .Create = True Then
Set pdoc = CreateObject("AcroExch.PDDoc")
For i = 0 To args.Count - 1
Select Case LCase(fso.GetExtensionName(args(i)))
Case "pdf"
If pdoc.Open(args(i)) = True Then
.InsertPages .GetNumPages() - 1, pdoc, 0, pdoc.GetNumPages() - 1, True
pdoc.Close
End If
End Select
Next
Set pdoc = Nothing
.Save PDSaveFull, fp
.Close
End If
End With
MsgBox "結合したPDFファイルを【" & fp & "】に保存しました。", vbInformation + vbSystemModal
上記スクリプトを実行すると、元のファイルと同じフォルダに結合されたPDFファイルが出力されます。
コードのメッセージ表示部分を修正すれば、コマンドラインからバッチ処理として実行することもできるので、大量のPDFファイルの結合処理にお悩みの方は是非一度お試しください。




















この記事へのコメントはありません。