Friday, July 9, 2010

manipulating pdfs with pdftk

I've been downloading some PDF articles that I wanted joined together for duplex printing purposes. While Ghostscript can join PDFs quite well, pdftk is a great tool for removing pages that I didn't want to keep (before joining). Linux.com has a good article to get started.

I specifically wanted to remove the last page of each of my documents. To remove the last page, I needed to know how long the document was:

$ pdftk article.pdf dump_data output | grep NumberOfPages
NumberOfPages: 132

Then I can use the "cat" function of pdftk to create a new PDF minus the last page. Then, I can merge all the documents. I should probably write a bash script for this.

No comments:

Post a Comment