Save this file as ai2svg
, make it executable via chmod +x ai2svg
then run it optionally passing the folder to look for.
It will convert in that folder, or the current one, all .ai files into .svg
#!/usr/bin/bash
createsvg() {
local margin="$1"
local d
local svg
for d in *.ai; do
svg=$(echo "$d" | sed 's/.ai/.svg/')
echo "creating $svg ..."
# old version: inkscape "$d" -l -o "$svg"
if [ "$margin" != "" ]; then
inkscape "$d" --export-area-drawing --export-margin $margin "--export-plain-svg=$svg"
else
inkscape "$d" --export-area-drawing "--export-plain-svg=$svg"
fi
done
}
if [ "$1" != "" ];then
cd $1
fi
createsvg "$2"
Contrary to what I wrote in my previous post, It is possible to add margins, look at SO ticket :
https://graphicdesign.stackexchange.com/a/155523/144183
--export-margin 20
where 20 is inpixels"user unit"