Archive for August, 2011
svg2pdf and svg2eps (convert svg to pdf or eps from the command line)
Posted by cheshirekow in LaTeX, Projects on August 11, 2011
I’ve been working on a new makefile for my latex projects. The goal is to have single-source builds of dvi, pdf, and xhtml documents. I ran into a problem of generating figures. latex expects eps graphics, pdflatex expects pdf figures, and latexml expects png figures (or will try to generate them). In order to generate documents with make, I need a way to generate eps and pdf figures from svg sources (I usually use inkscape to make my figures). Inkscape can be run from the command line, but I dont want to install inkscape on my server because that will require installing a ton of libraries that don’t make sense to have on a server with no graphical interface.
As it turns out, writing such a command line tool is very easy with librsvg and cairo. Carl Worth of redhat has produced a nice demo of svg2pdf which can be found at freedesktop.org. I cloned his project, create a cmake project out of it, and made a trivial modification to turn it into svg2eps as well.
You can find my code at git://git.cheshirekow.com/svg2x.git and there’s some doxygen documentation Doxygen documentation.