Skip to content

Instantly share code, notes, and snippets.

@tenomoto
Created April 28, 2015 07:59
Show Gist options
  • Save tenomoto/82dd5ecf53b85f9a8b1c to your computer and use it in GitHub Desktop.
Save tenomoto/82dd5ecf53b85f9a8b1c to your computer and use it in GitHub Desktop.
Create EPS from PDF with white margin cropped using pdfcrop and pdftoeps
#!/bin/sh
if [ $# -lt 1 ]; then
echo "Usage :: $0 input.pdf [p1 p2 ...]"
exit
fi
in=${1}
shift
pdfcrop ${in}
crop=`basename -s .pdf ${in}`-crop
if [ $# -eq 0 ]; then
pdftops -f 1 -l 1 -eps ${crop}.pdf && mv ${crop}.eps ${in%.pdf}.eps
else
while [ $# -gt 0 ]; do
p=$1
pdftops -f ${p} -l ${p} -eps ${crop}.pdf && mv ${crop}.eps ${in%.pdf}_${p}.eps
shift
done
fi
rm ${crop}.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment