Editing pdf files on gnu/linux

To remove the forth page from the pdf file named “old.pdf” and save it as “new.pdf” the command pdftk from the pdf tool kit project can save the day:

pdftk old.pdf cat 1-3 5-end output new.pdf 

Combining multiple pdf files into a single one is even simpler:

pdftk one.pdf two.pdf three.pdf cat output combined.pdf

The last task can alternatively be achieved with a powerful gostscript interpreter and previewer.

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combined.pdf -dBATCH one.pdf two.pdf three.pdf

The ghostscript command to rescale all images in a pdf to 300dpi:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dUseCIEColor -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf 

This above shown command is very useful and I apply it every time when I need to shrink a pdf file in size. For example my CV, which I have written in XeLaTeX with a jpg picture of me included was about 4.6 MB. After processing it with a ghostscript command its size was reduced to 90.6 kB. This is a remarkable result.