Compress pdf files

#!/bin/bash
# For this script ghostscript package is needed. either install it or download static compiled binary for it.
echo "This script will Compress all pdf files with prefix Compressed-"
echo "do you wish to run the script (y/N)"
read ans
if [[ $ans == y ]] || [[ $ans == Y ]]
then
for i in *.pdf ;do
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=Compressed-$i $i
done
else
echo Exiting..
fi

  

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy This Password *

* Type Or Paste Password Here *

5,177 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>