Friday, July 19, 2013

Extract PDF Page and Page Ranges (Oh Yeah, and Merge Them Together Again) Using pdftk in Ubuntu

So, following up on the previous thread about using pdftk to rotate pdf's, here is a follow-up for those times you need to get a single page of a range of pages from a larger PDF document.

First, install pdftk:


  $ sudo apt-get install pdftk 



For example, to extract pages 22-36 from a 100-page PDF file using pdftk:

  $ pdftk A=100p-inputfile.pdf cat A22-36 output outfile_p22-p36.pdf


When you invariably need to put them back into a single large document again, just:

  pdftk in1.pdf in2.pdf cat output out1.pdf


To more fun ways you can use pdftk, check out the website examples page.