Friday, April 10, 2015

Dropping pages from a pdf

When I got a journal article through Illiad, there was an annoying first page about copyright law. After futzing around with Preview for a while, I downloaded a command-line tool:

sudo port install pdftk

My foo.pdf was 10 pages, so to get pages 2-10 I just did

pdftk foo.pdf cat 2-10 output out.pdf

Bonus: I wrote a script that reads the output from the dump_data command. One of those lines is NumberOfPages, so I parsed that number and put that into the cat command so I wouldn't have to look it up myself.

No comments:

Post a Comment