Table of Contents

Pdftk

pdftk is a useful tool for manipulating pdf files.

Merge pdf files

To merge two or more pdf files (file1.pdf, file2.pdf,…) use the following command:

pdftk file1.pdf file2.pdf file3.pdf cat output merged.pdf

the file merged.pdf is the concatenation of file1.pdf, file2.pdf and file3.pdf

Extract a range of pages from a pdf

Extract pages from 1 to 10 and from 12 to the end, and save the extracted pages on the file out.pdf. Practically, this command removes page number 11.

pdftk input.pdf cat 1-10 12-end output out.pdf

Rotate all the pages of a pdf of 90 degrees clockwise

pdftk input.pdf cat 1-endeast output out.pdf

Install pdftk in Ubuntu 18.04 or newer

To install pdftk in Ubuntu 18.04 or newer you have to type the following command:

sudo snap install pdftk