LoginSignup
55
44

More than 5 years have passed since last update.

コマンドラインでpdfを連結する方法

Last updated at Posted at 2015-12-16

ghostscript

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf input1.pdf input2.pdf ...

でいける。

convert

convert input*.pdf output.pdf

pdftk

pdftkとは、pdfを編集するコマンドラインツール。結合だけじゃなく、分割や透かし入れたり色々出来る。こことかこことかに詳しい。
Homebrewで入れるには

$  brew search pdftk
No formula found for "pdftk".
==> Searching pull requests...
Closed pull requests:
pdftk: 2.02 - a Handy Tool for Manipulating PDF Documents (https://github.com/Homebrew/homebrew/pull/25953)

ということなので、

$  brew pull https://github.com/Homebrew/homebrew/pull/25953
######################################################################## 100.0%
==> Applying patch
Applying: pdftk: 2.02 - a Handy Tool for Manipulating PDF Documents
==> Patch closes issue #25953
==> Patch changed:
 Library/Formula/pdftk.rb | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

で、searchできるようになる。

$  brew search pdftk
pdftk
$ brew install pdftk

結合するときは

$ pdftk input1.pdf input2.pdf input3.pdf cat output out.pdf

catで結合
output filenameで出力するファイル名

55
44
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
55
44