How to merge PDF files

I keep forgetting how to do this under *NIX, so I post the solution here to make it easier for me to find it. It looks like the easiest way to accomplish this is the following:

Run Ghostscript like this. Put all your PDF files in a single directory, make it the current directory and execute the command:

gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -sOutputFile=out.pdf *.pdf

(or if you want to specify the files, or merge them in something other than alphabetic order, replace *.pdf by a list of files).

Comments 5

  1. Philip Paeps wrote:

    The scripts from pdfjam (ports/print/pdfjam) make this even easier. For one, you don’t need to type all those funky gs switches yourself. :-)

    Posted 10 May 2007 at 11:02 am
  2. Matteo wrote:

    @Philip: but it requires Bash….

    Posted 10 May 2007 at 11:05 am
  3. martijn wrote:

    but pdfjam has about 100MB worth of dependencies, so thanx for this useful tip!

    Posted 01 Jun 2007 at 2:42 pm
  4. Jorge Avila wrote:

    Great info! I’m a noob, and I’ve never had anything work so perfectly, so easily, the first time. Using Ubuntu 9.10, merged 73 files with no problem. Thank You!

    Posted 07 Dec 2009 at 6:18 am
  5. cate wrote:

    migliore!

    Posted 11 Dec 2009 at 12:35 am

Trackbacks & Pingbacks 1

  1. From This is funny at Matteo’s Wasps’ Nest on 17 May 2007 at 2:51 pm

    [...] got the following message while merging some PDF files as described in a previous post… **** Warning: Fonts with Subtype = /TrueType should be embedded. The following fonts were [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *