pdftk (PDF Toolkit) is a command-line tool which enables you to edit pdf files. pdftk is freely available on Linux, MS Windows, MacOS X and FreeBSD. So using pdftk, you can edit pdf files without having to pay for a commercial pdf editor. If you would like to install pdftk on Linux, proceed as follows.
To install pdftk on Ubuntu or Debian:
To install pdftk on CentOS, Fedora or RHEL:
$ wget http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-1.44-src.zip
$ unzip pdftk-1.44-src.zip
$ cd pdftk-1.44-dist/pdftk
$ make -f Makefile.Redhat
$ sudo make install
To install pdftk on other platforms such as MS Windows and MacOS X, you can download pdftk ports for Windows and OS X here.
Once you have installed pdftk on your system, you can edit pdf files using pdftk as follows.
To merge pdf files:
To extract pages from a pdf file (e.g., extract pages 3, 4 and 5 into a new pdf):
To remove pages from a PDF file (e.g., remove page 3 and create a new pdf without the page):
To rotate each page of a multi-page pdf document 180 degrees:
To rotate each page of a multi-page pdf document 90 degrees clockwise:
To rotate each page of a multi-page pdf document 90 degrees counterclockwise:
To reverse the order of pages in a multi-page pdf document:
To select pages of different pdf documents into a new pdf:
It selects pages 3, 4, 5 from input1.pdf, pages 1, 2, 3 from input2.pdf, and page 10 from input1.pdf into a new pdf.
To add a watermark to a pdf file:
A watermark image file (watermark.pdf) is applied to every page of input.pdf.
To merge two pdf files as odd and even pages:
To merge two pdf files as odd and reversed even pages:
To merge two pdf files as odd and reversed/180-rotated even pages:
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.