Today, I was looking for a way to extract pages from a pdf file with the command
line interface and stumbled on this answer on ,
and so I decided to try PDFtk. After a quick
installation (apt-get install pdftk
), I simply reproduced the example in the
answer with my file!
|
|
Very handy, quite easy to use and efficient! Digging a little more the documentation, it turns out that you can do way more! For instance, with the same cat
options, you can actually create assemblages of different PDF files with specific range of pages and specific orientations, for instance :
|
|
This single command line:
- take the 2 pdf
book1.pdf
andbook2.pdf
files as inputs; - take the pages from 1 to 5 that have an
even
number (so 1, 3 and 5) of the first pdf and turn them upside down (south
); - take
even
pages from 2 to 4 (so 2 and 4) from the second file; - combine them in
out.pdf
.
Pretty sweet 😄!