2016-2017/tools/Other/doublea5.sh

27 lines
728 B
Bash

#!/bin/bash
IFS=$'\n'
pdfs=`find $1 -iname "*.pdf"`
for i in $pdfs; do
# On va chercher le format du pdf
info=`pdfinfo "$i"`
#echo "$info"
size=`echo "$info" | grep "Page size" | cut -d':' -f2`;
# On enlève les espaces
size=${size//[[:blank:]]/};
#echo "Size" $size
# On va chercher le format du pdf
page=`echo "$info" | grep "Pages" | cut -d':' -f2`;
# On enlève les espaces
page=${page//[[:blank:]]/};
#echo $size
if [ $size = "419.528x595.276pts" ] && [ $page = "1" ]; then
outfile=${i%.pdf}_a4.pdf
if ! [ -f $outfile ]; then
echo "On double $i vers $outfile"
pdfnup --suffix a4 $i $i --outfile $outfile
fi
fi
done