]> git.sthu.org Git - ipestuff.git/blob - ipeify.sh
ipe: Add thickness style file
[ipestuff.git] / ipeify.sh
1 #!/bin/bash
2 # shuber, 2010-01-05
3
4 if [[ $# < "1" ]]; then
5 echo "$0 <file> [params to pdftoipe]"
6 echo ""
7 echo "Convert eps, pdf and svg files to Ipe xml-files."
8 exit -1
9 fi
10
11
12 infile=$1
13 shift
14 infileend=${infile##*.}
15
16 if [[ ! -f "$infile" ]]; then
17 echo "No file '$infile'"
18 exit -1
19 fi
20
21
22 md5infile=`cat $infile | md5sum | cut -d ' ' -f 1`
23 outfile="${infile%%.*}.xml"
24
25 case $infileend in
26
27 eps|svg )
28 tmppdffile="/tmp/${md5infile}.pdf"
29
30 case $infileend in
31
32 eps )
33 epstopdf "$infile" --outfile $tmppdffile || exit -2
34 ;;
35
36 svg )
37 inkscape "$infile" --export-pdf=$tmppdffile || exit -2
38 ;;
39
40 * )
41 echo "Script author is lame. Tell him!"
42 ;;
43 esac
44
45 pdftoipe $tmppdffile "$outfile" $@ || exit -2
46 rm $tmppdffile
47 ;;
48
49 pdf )
50 pdftoipe "$infile" "$outfile" $@ || exit -2
51 ;;
52
53 * )
54 echo "Unknown filetype '$infileend'"
55 exit -1
56 ;;
57 esac
58
59
60