pdftk (manipulate PDF files)

This tool lets you do all sorts of things with PDF documents, such as split, merge or rotate them, apply a background watermark, burst documents into single pages, etc. I mostly use pdftk to split PDF files, which is done like so:

pdftk in.pdf cat 2-8 output out.pdf

This will extract pages 2 through 8 from in.pdf and save them as out.pdf. The input file in.pdf will not be altered. You can use any other page range in place of 2-8. Leave out the range to select the whole document.

Here is an example of how to merge PDF files:

pdftk in1.pdf in2.pdf cat output out.pdf

This will concatenate in1.pdf and in2.pdf, saving the result as out.pdf. If you want to merge individual page ranges, you have to assign handles to input files, like so:

pdftk A=in1.pdf B=in2.pdf cat A2-3 B4-5 \

output out.pdf

This will merge pages 2-3 from in1.pdf with pages 4-5 from in2.pdf into out.pdf. The backslash means that the input is continued on the next line. You can use it when you type in long commands, but you don't have to.

This section has barely scratched the surface of what pdftk can do. The utility has an excellent →man page with lots of practical examples.