Extracting pages from a pdf file using linux command line

pdftk is a tool which we can use to split or extract pages from a pdf document.

To install pdfktk on debian based systems

Let us say we have a pdf file,temp.pdf, with 100 pages in it. We want to extranct the pages 20 to 30 and create a new pdf . We can do it using pdftk

If the command returns to the prompt with no errors, we will have a new pdf file in the same directory with the name new.pdf.

We can pick specific pages instead of a range by just passing the page numbers.

To create a new pdf by extracting pages 21,25, and 28 we can use.

We can also select only even/odd pages by passing the option even/odd respectively

To extract all the odd numbered pages we can use the range as 1-end and use the keyword odd.

No comments:

Post a Comment

Follow by Email