Compress PDFs and combine in Linux

Wanted to reduce the size and also combine a few scanned files in pdf format.

Ghost script was very nifty

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -sOutputFile=out.pdf scan1.pdf scan2.pdf scan3.pdf scan4.pdf

-dPDFSETTINGS=/ebook – was the key for resolution

-dPDFSETTINGS=/screen   (screen-view-only quality, 72 dpi images)
-dPDFSETTINGS=/ebook    (low quality, 150 dpi images)
-dPDFSETTINGS=/printer  (high quality, 300 dpi images)
-dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs)
-dPDFSETTINGS=/default  (almost identical to /screen)


Refer : http://milan.kupcevic.net/ghostscript-ps-pdf/#refs

Thanks to http://stackoverflow.com/questions/8158584/ghostscript-to-merge-pdfs-compresses-the-result