Thursday, September 23, 2010

How to merge pdf files into one from command line

Put all the pdf files into a directory
I named them as ch00.pdf, ch01.pdf, etc.
Run on linux command(mac, cygwin, you need Ghostscript installed):
  gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf *.pdf

This method preserves the table of contents of each pdf file


  1. Another good option that I find often generates smaller PDFs is to use the LaTeX package pdfpages. For example, just run the following through pdflatex:




    This approach will let you exclude certain pages, move pages around, etc., and even let you generate a new TOC as you wish. If you have LaTeX installed, you probably already have this package.


Subscribe via email

Enter your email address:

Delivered by FeedBurner


Blog Archive