PDF Utility pdftk – Making handling PDF files easy

By | October 10, 2015

You may have already read our previous article how to install PDFTK on your Centos or Red Hat server HERE so here are some of the uses for pdftk that you may find useful.

Merge multiple PDF files using pdftk

PDF Utility PDFTK makes it easy to merge any number of pdf files into a single output file. First here is how to merge 2 specific files :

pdftk input1.pdf input2.pdf cat output output.pdf

If you want to merge a whole list of pdf files you can use wildcards like this :

pdftk *.pdf cat output output.pdf

ok all pretty simple so far, so how about the reverse… you now have a multi page pdf file and want to split it into seperate single page pdf files. Here is how you do it :

pdftk bigfile.pdf burst

The above will generate multiple numbered output files each with a single page.

So now maybe you have multiple multi-page pdf files and you want to merge specific pages from them into a new output file. This is how it is done :

pdftk X=bigfile1.pdf Y=bigfile2.pdf Z=bigfile3.pdf cat X2-3 Y1-2 Z9 X12 output output.pdf

this will create output.pdf with pages 2-3 of bigfile1.pdf, followed by pages 1-2 of bigfile2.pdf, page 9 of bigfile3.pdf, and then page 12 of bigfile1.pdf.

There is much more functionality inside pdftk, but this gives you a quick insight into just some of the things it can do.

We hope you find this useful!

Check out -  Using the built-in Bash Special Variables

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.