Using "pdftk" to manipulate PDF files

The “pdftk” program (available here) is a commandline program that can split and combine PDF files (among other functions).

The source website has links to graphical user interfaces for pdftk, but the guidelines here assume you are using the industrial-strength commandline version.

See if pdftk is installed

To use it, first see if it has been installed on your computer (if it hasn’t been, take care of that first!). To determine that:

  1. Open a terminal window
  2. Type the following: pdftk
  3. Press the Return key

If “pdftk” is installed, you’ll see “SYNOPSIS” followed by some brief help information. If it is not installed, you’ll see an error message that your system could not find it.

Combining multiple PDF files into one PDF file

Imagine you have three PDF files (file1.pdf, file2.pdf, and file3.pdf) that you would like to combine into one big PDF file (all.pdf).

  1. Open a terminal window
  2. Navigate to the directory containing the three PDF files (using the cd command)
  3. Type the following: pdftk file1.pdf file2.pdf file3.pdf cat output all.pdf
  4. Press the Return key

You should now have a new all.pdf file.

Splitting one PDF file into multiple files

Imagine that you have one big PDF file (big.pdf) that is 55 pages long. You would like to split it into 20-page (or fewer) parts.

  1. Open a terminal window
  2. Navigate to the directory containing the three PDF files (using the cd command)
  3. Type the following (press the Return key after each line):
  • pdftk big.pdf cat 1-20 output part-001.pdf
  • pdftk big.pdf cat 21-40 output part-002.pdf
  • pdftk big.pdf cat 41-end output part-003.pdf

You should now have three new PDF files, each containing the pages that you specified in the commandlines.

 
systems/pdftk.txt · Last modified: 2007/05/03 22:41 by deanpentcheff
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki