Created
April 18, 2017 02:52
-
-
Save cllu/68bc52db9408be16edb0cade1bb73615 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
conversion (){ | |
# get file name without extension, full path | |
b="${1%%.*}" | |
b=`basename $b` | |
full=`grealpath $1` | |
echo "Converting: $1 (Absolute path: $full)" | |
dir="`dirname $full`/eps" | |
mkdir -p $dir | |
pdftops -eps $full | |
mv "`dirname $full`/$b.eps" ${dir}/${b}.eps 2>/dev/null | |
if [ $? -ne 0 ]; then echo "pdftops failed" && pdftops=false; fi | |
} | |
if [[ -f $1 ]]; then | |
# if a single file | |
conversion $1 | |
elif [[ -d $1 ]]; then | |
# else if a directory | |
for i in `ls $1/*.pdf`; do | |
conversion $i | |
done | |
else | |
echo "Call: ./pdf2eps [PDF file]" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment