Skip to content

Instantly share code, notes, and snippets.

@cllu cllu/pdf2eps

Created Apr 18, 2017
Embed
What would you like to do?
#!/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
You can’t perform that action at this time.