Inkscape batch convert SVG to PDF

Saturday, March 16th, 2013

I recently had the problem that i needed to convert a lot of .svg files to .pdf for use in a LATEX document.

Inspired by this ubuntuforums post here is a little piece of bash that allows you to do the conversion for all .svg files in the current directory:

for i in *.svg; do inkscape -C $i -A=`echo $i | sed -e 's/svg$/pdf/'`; done

The -C tells inkscape to use the page as defined in the svg as export region. Replacing it with -D will make sure that all drawn objects are included. Of course you can also use the same technique to do e.g. a png export:

for i in *.svg; do inkscape -C $i -e=`echo $i | sed -e 's/svg$/png/'`; done

For more useful options check the inkscape man page.