4

I have 2 files written in Markdown which I used pandoc to convert into pdf. I now need to combine the 2 into one single document(lets say I have many that I need to combine into a single pdf). Is there a way I can do this efficiently from the terminal itself ?

The simplest way I can think of is by cat ing the files into one as such

cat file1.pdf file2.pdf > file3.pdf 

But this does not provide the desired result. It only produces the first file (depending on whether I put file1 or file2).

Is there a general way of combining different files into one single "entity" without messing up the pages. Say I had to compile a number of pdf "chapters" into a pdf "book" ?

1 Answers1

5

The usual tool is pdftk. This command will take first.pdf and second.pdf, and create a new merged.pdf which is the concatenation of the two source files:

pdftk first.pdf second.pdf cat output merged.pdf
Chris Davies
  • 4,560