|
|
|
@ -5,11 +5,11 @@ function usage
|
|
|
|
|
{
|
|
|
|
|
echo "usage: pdf-optimize [options] input.pdf"
|
|
|
|
|
echo " ";
|
|
|
|
|
echo " -o | --output : output filename";
|
|
|
|
|
echo " -q | --quiet : run quietly";
|
|
|
|
|
echo " -v | --verbose : run verbosly";
|
|
|
|
|
echo " -y | --yes-to-replace : yes to replace existing files";
|
|
|
|
|
echo " -h | --help : print this message";
|
|
|
|
|
echo " -o | --output : output filename";
|
|
|
|
|
echo " -q | --quiet : run quietly";
|
|
|
|
|
echo " -v | --verbose : run verbosly";
|
|
|
|
|
echo " -y | --yes-to-replace : yes to replace existing files";
|
|
|
|
|
echo " -h | --help : print this message";
|
|
|
|
|
echo " ";
|
|
|
|
|
echo "If no output path is specified, given input.pdf as input will output
|
|
|
|
|
input_compressed.pdf"
|
|
|
|
@ -27,12 +27,12 @@ function arg_parse
|
|
|
|
|
|
|
|
|
|
while [ "$1" != "" ]; do
|
|
|
|
|
case "$1" in
|
|
|
|
|
-o | --output ) output_path="$2"; shift;;
|
|
|
|
|
-q | --quiet ) quiet=1;;
|
|
|
|
|
-v | --verbose ) verbose=1;;
|
|
|
|
|
-y | --yes-to-replace ) replace=1;;
|
|
|
|
|
-h | --help ) usage; exit;;
|
|
|
|
|
* ) args+=("$1")
|
|
|
|
|
-o | --output ) output_path="$2"; shift;;
|
|
|
|
|
-q | --quiet ) quiet=1;;
|
|
|
|
|
-v | --verbose ) verbose=1;;
|
|
|
|
|
-y | --yes-to-replace ) replace=1;;
|
|
|
|
|
-h | --help ) usage; exit;;
|
|
|
|
|
* ) args+=("$1")
|
|
|
|
|
esac
|
|
|
|
|
shift
|
|
|
|
|
done
|
|
|
|
@ -66,8 +66,8 @@ function yes_or_no
|
|
|
|
|
{
|
|
|
|
|
read -p "$* [y/N]: " ans
|
|
|
|
|
case "$ans" in
|
|
|
|
|
[yY] | [yY]es ) return 0;;
|
|
|
|
|
* ) echo "Aborting"; return 1;;
|
|
|
|
|
[yY] | [yY]es ) return 0;;
|
|
|
|
|
* ) echo "Aborting"; return 1;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -128,7 +128,8 @@ function compute_compression
|
|
|
|
|
input_size_h=`du -h "$input_path" | cut -f1`
|
|
|
|
|
output_size_h=`du -h "$output_path" | cut -f1`
|
|
|
|
|
|
|
|
|
|
echo "Size reduced from ${bold}$input_size_h${normal} to ${bold}$output_size_h${normal} [$percentage %]"
|
|
|
|
|
echo "Size reduced from ${bold}$input_size_h${normal} to \
|
|
|
|
|
${bold}$output_size_h${normal} [$percentage %]"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# font settings
|
|
|
|
|