[OS X TeX] Re: svg to pdf

Jens Noeckel noeckel at uoregon.edu
Tue Jul 11 05:06:15 CEST 2006


On Jul 9, 2006, at 4:17 PM, Ross Moore wrote:
> I've spent several hours last Saturday trawling the web for
> SVG-->PDF converters. There are several that claim to do it,
> but most simply put a wrapper around a bitmap, at some fixed
> resolution.
>
> What we really want is a conversion that retains the
> "vector graphics" character of the resulting PDF file.
> For this, the natural expectation is that such a converter
> would come from Adobe, or use Ghostscript, since it must
> generate (a flavour of) raw PostScript coding, suitably
> wrapped (distilled ?) for PDF.
>
> Adobe's Illustrator CS certainly opens SVG images, which
> can then be resaved as PDF.
> Can this be automated using scripts and Apple events?
>
>
> Here's what Ghostscript documentation says about the
> possibility of having an SVG interpreter.
>
>
>   ** SVG (XML Structured Vector Graphics) interpreter. **
>
>   Ghostscript could be adapted with some work to read SVG.  This  
> would be an
>   interesting and challenging project because SVG's graphics model  
> would
>   require extending the library (see above).
>   "If SVG turns out to be an important standard, it is important that
>   there be a good free implementation of it."
>
> Quite. That message was formulated 4-5 years ago, I think.
>

Ross,
Inkscape or sodipodi should be the answer to "all your problems"...  
they can be used as a command line utilities and can open SVG. Here,  
I'm referring to the versions of these programs that can be installed  
via fink.

I've just experimented some more to see whether inkscape or sodipodi  
are better, and inkscape has won (it is able to translate gradients).  
So here is a script that one can install as svg2pdf instead of the  
ones you listed:

#!/bin/csh
inkscape --print='| pstopdf -i -o '`basename -s svg "$1"`pdf "$1"

This takes one argument: an SVG filename. It requires that a command- 
line inkscape (e.g., fink's) be installed. It writes a pdf file with  
the same base name as the input file. Just copy the above two lines  
to a file called svg2pdf in your PATH and make it executable (e.g.,  
chmod 700 svg2pdf).

That's all. I initially had some problems with this because fink's  
inkscape installation had a snafu, but the only thing a fink user has  
to do to install inkscape is to type the following:
sudo fink install inkscape
sudo fink install gnome-vfs2-ssl

Regards,
Jens





------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list