Wednesday, March 24, 2010

How to merge or reduce pdf file-size under Linux Distributions

How many times were you in a position in which you needed to merge, or reduce the size of some .pdf files ? If you are using a Linux distribution, then you can rely on some simple command-line instructions to allow you to do so easily.

First, in order to start editing the pdf files, you have to install two packages, namely Ghostscript and PDFTK. Now, in order to merge the two files enter the following in the terminal:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=firstANDsecond.pdf -dBATCH first.pdf second.pdf

Notice the "AND" between the first and second files.

Now, in order to reduce the size of the pdf files, you will have to type the following in the terminal:

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

I hope this post is helpful.

No comments: