Thursday, February 27, 2014

Remove pages from a pdf

Let's say we want to remove the first page of a bunch pdf files. Or there is one particular page that needs t be removed. Or the pages needs to be rearranged. There is no need for professional software for this like Adobe pro. A simple program called pdftk can do the job.

Let us say that we want to remove just the first page from the pdf. The following command does the trick.

pdftk file.pdf cat 2-end output newfile.pdf

More complicated page rearrangement can be done too. Say we want pages 3-5 after page 18.

First we save pages 3-5 in file temp2.pdf. Then cut out those pages and save the file in temp.pdf. Now the page 18 is page 15 since we have removed 3 pages from the original file. So we get pages 1-15 in one file and the rest in another. We can then join 1-15 + 3-5 + 16-end and voilĂ .

pdftk file.pdf cat 3-5 output temp2.pdf
pdftk file.pdf cat 1-2 6-end output temp.pdf
pdftk temp.pdf cat 1-15 output temp1.pdf
pdftk temp.pdf cat 16-end output temp3.pdf
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf temp1.pdf temp2.pdf temp3.pdf


No comments:

OK GOOGLE on Samsung Galaxy S7 doesn’t work

To make Ok Google detection work on Galaxy S7 (Galaxy series phones) we need to perform a couple of steps. 1. As long as Samsung S vo...