-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconv_script.sh
More file actions
executable file
·52 lines (38 loc) · 840 Bytes
/
conv_script.sh
File metadata and controls
executable file
·52 lines (38 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
function dirtest() {
wrk_dir="$1"
[ ! -d "${wrk_dir}" ] && mkdir ${wrk_dir}
[ "$(ls -A ${wrk_dir})" ] && echo "Directory not empty." && exit -1
}
function conv2svg() {
wrk_dir="svg_files"
dirtest $wrk_dir
for i in `ls *.pdf`
do
fname=${i%%.pdf}
inkscape --without-gui --file=$i --export-plain-svg=${wrk_dir}/${fname}.svg
done
}
function conv2png() {
wrk_dir="png_files"
dirtest $wrk_dir
for i in `ls *.pdf`
do
fname=${i%%.pdf}
inkscape --without-gui $i -z --export-dpi=150 \
--export-area-drawing --export-png=${wrk_dir}/${fname}.png
done
}
function fhelp() {
echo -e "\n\tUsage:"
echo -e "\t\t$0 [svg|png]\n"
}
if [ "$1" == "png" ]
then
conv2png
elif [ "$1" == "svg" ]
then
conv2svg
else
fhelp
fi